Part Number Hot Search : 
FR207 AO443511 OPB824A BLX94 FRS1M ACT711S C5000 20KW160
Product Description
Full Text Search
 

To Download ST72F62 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  june 2003 1/132 rev. 2.2 st7262 low speed usb 8-bit mcu with 3 endpoints, flash or rom memory, lvd, wdg, 10-bit adc, 2 timers, sci, spi n memories C 8k or 16k program memory (rom, fastrom or dual voltage flash) with read-write protection C in-application and in-circuit programming for flash versions C 384 to 768 bytes ram (128-byte stack) n clock, reset and supply management C enhanced reset system (power on reset) C low voltage detector (lvd) C clock-out capability C 6 or 12 mhz oscillator (8, 4, 2, 1 mhz internal frequencies) C 3 power saving modes n usb (universal serial bus) interface C dma for low speed applications compliant with usb 1.5 mbs specification (v 1.1) and usb hid specification (v 1.0): C integrated 3.3v voltage regulator and trans- ceivers C suspend and resume operations C 3 endpoints n up to 31 i/o ports C up to 31 multifunctional bidirectional i/o lines C up to 12 external interrupts (3 vectors) C 13 alternate function lines C 8 high sink outputs (8 ma@0.4 v/20 ma@1.3 v) C 2 true open drain pins (n buffer 8 ma@0.4 v) n 3 timers C configurable watchdog timer (8 to 500 ms timeout) C 8-bit auto reload timer (art) with 2 input captures, 2 pwm outputs and external clock C 8-bit time base unit (tbu) for generating pe- riodic interrupts cascadable with art n analog peripheral C 10-bit a/d converter with up to 8 input pins. n 2 communications interfaces C asynchronous serial communication inter- face C synchronous serial peripheral interface n instruction set C 8-bit data manipulation C 63 basic instructions C 17 main addressing modes C 8 x 8 unsigned multiply instruction C true bit manipulation n nested interrupts n development tools C full hardware/software development package device summary pdip32 shrink so34 shrink tqfp44 pdip42 shrink so20 pdip20 features st72623f2 st72622k2 st72621k4 st72622l2 st72621l4 st72621j2 st72621j4 program memory - bytes 8k 8k 16k 8k 16k 8k 16k ram (stack) - bytes 384 (128) 384 (128) 768 (128) 384 (128) 768 (128) 384 (128) 768 (128) peripherals usb, watchdog, low voltage detector, 8-bit auto-reload timer, timebase unit, a/d converter serial i/o - spi spi + sci spi spi + sci i/os11212331 operating supply 4.0v to 5.5v (low voltage 3.0v to 5.5v rom versions available) operating temperature 0c to +70c packages pdip20/so20 pdip32 so34 pdip42/tqfp44 1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
table of contents 132 2/132 1 1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1 pcb layout recommendation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 register & memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 4 flash program memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.2 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.3 structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.4 icc interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.5 icp (in-circuit programming) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6 iap (in-application programming) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.7 related documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.8 register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5 central processing unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.2 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.3 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 6 clocks and reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 6.1 clock system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 6.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 7 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7.2 masking and processing flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7.3 interrupts and low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 7.4 concurrent & nested management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 7.5 interrupt register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 7.6 interrupt register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 8 power saving modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 8.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 8.2 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 8.3 halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 9 i/o ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 9.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 9.2 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 9.3 miscellaneous register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 10 on-chip peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 10.1 watchdog timer (wdg) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 10.2 pwm auto-reload timer (art) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 10.3 timebase unit (tbu) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 10.4 serial peripheral interface (spi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 10.5 serial communications interface (sci) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
table of contents 132 3/132 10.6 usb interface (usb) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 10.7 10-bit a/d converter (adc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 11 instruction set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 11.1 cpu addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 11.2 instruction groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 12 electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 12.1 parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 12.2 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 12.3 operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 12.4 supply current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 12.5 clock and timing characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 12.6 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 12.7 emc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 12.8 i/o port pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 12.9 control pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 12.10timer peripheral characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 12.11communication interface characteristics . . . . . . . . . . . . . . . . . . . . . . . . 117 12.1210-bit adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 13 package characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 13.1 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 14 device configuration and ordering information . . . . . . . . . . . . . . . . . . . . . . . 126 14.1 option byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 14.2 device ordering information and transfer of customer code . . . . . 126 14.3 development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 15 important notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 15.1 unexpected reset fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 15.2 halt mode power consumption with adc on . . . . . . . . . . . . . . . . . . . . . . . . . 130 16 summary of changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 to obtain the most recent version of this datasheet, please check at www.st.com>products>technical literature>datasheet please p ay special attention to the section important notes on page 130. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 4/132 1 introduction the st7262, st72p62 and ST72F62 devices are members of the st7 microcontroller family de- signed for usb applications. all devices are based on a common industry- standard 8-bit core, featuring an enhanced instruc- tion set. the st7262 devices are rom versions. the st72p62 devices are factory advanced service technique rom (fastrom) versions: they are factory-programmed and are not repro- grammable. the ST72F62 versions feature dual-voltage flash memory with flash programming capa- bility. under software control, all devices can be placed in wait, slow, or halt mode, reducing power consumption when the application is in idle or standby state. the enhanced instruction set and addressing modes of the st7 offer both power and flexibility to software developers, enabling the design of highly efficient and compact application code. in addition to standard 8-bit data management, all st7 micro- controllers feature true bit manipulation, 8x8 un- signed multiplication and indirect addressing modes. figure 1. general block diagram 8-bit core alu address and data bus oscin oscout reset port b usb sie port a sci port c spi pb7:0 (8 bits) pc7:0 (8 bits) oscillator internal clock control ram (384, pa7:0 (8 bits) v ss v dd power supply program (8 or 16k bytes) lvd 10-bit adc memory watchdog usbdp usbdm usbvcc pwm art usb dma v ssa v dda port d pd6:0 (7 bits) time base unit v pp or 768 bytes) 1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 5/132 2 pin description figure 2. 44-pin tqfp and 42-pin sdip package pinouts 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 38 37 36 35 34 33 32 31 30 29 28 27 16 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 39 40 41 42 pd6 pd5 oscout oscin it9 / pc2 it10 / sck / pc3 it11 / ss / pc4 it12 / miso / pc5 mosi / pc6 pd1 v pp pd2 pd3 pd4 pc7 pd0 v dda usbvcc pb1 (hs) / rdi pb0 (hs) / mco pa7 / ain7 pa6 / ain6 pa5 / ain5 pa4 / ain4 pa3 / ain3 / it4 pa0 / ain0 / it1 / usboe reset v ssa usbdm usbdp pa1 / ain1 / it2 pa2 / ain2 / it3 21 20 17 18 19 it8 / pwm1 / pb7 (hs) pc0 pc1 v dd v ss 26 25 24 23 22 pb6 (hs) / pwm0 / it7 / iccdata pb5 (hs) / artic2 / it6 / iccclk pb4 (hs) / artic1 / it5 pb3 (hs) / artclk pb2 (hs) / tdo oscout oscin it9 / pc2 it10 / sck / pc3 it11 / ss / pc4 it12 / miso / pc5 mosi / pc6 pd1 v pp pc7 pd0 it8 / pwm1 / pb7 pc0 pc1 v dd v ss artclk / pb3 (hs) it5 / artic1 / pb4 (hs) iccclk / it6 / artic2 / pb5 (hs) iccdata /it7 / pwm0 / pb6 (hs) n.c. tdo / pb2 (hs) pb1 (hs) / rdi pb0 (hs) / mco pa7 / ain7 pa6 / ain6 pa5 / ain5 pa4 / ain4 pa3 / ain3 / it4 pa0 / ain0 / it1 / usboe reset pa1 / ain1 / it2 pa2 / ain2 / it3 v dda usbvcc v ssa usbdm usbdp pd3 pd4 reserved* pd6 pd5 pd2 * pin 39 of the tqfp44 package must be left unconnected. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 6/132 pin description (contd) figure 3. 34-pin so and 32-pin sdip package pinouts 28 27 26 25 24 23 22 21 20 19 18 29 30 31 32 pc4 / ss / int11 pc5 / miso / it12 pa4 / ain4 pa3 / ain3 / it4 pa2 / ain2 / it3 pa1 / ain1 / it2 pa0 / ain0 / it1 / usboe v ssa usbdm usbvcc v dda v pp reset pc6 / mosi usbdp pc7 16 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 it10 / sck / pc3 it9 / pc2 ain7 / pa7 mco / pb0 (hs) rdi / pb1 (hs) tdo / pb2 (hs) artclk / pb3 (hs) it5 / artic1 / pb4 (hs) iccclk / it6 /artic2 / pb5 (hs) it8 / pwm1 / pb7 (hs) v dd v ss oscout oscin iccdata / it7 / pwm0 / pb6 (hs) pa5 / ain5 ain6 / pa6 33 34 17 28 27 26 25 24 23 22 21 20 19 18 17 16 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 29 30 31 32 it10 / sck / pc3 it9 / pc2 ain7 / pa7 mco / pb0 (hs) rdi / pb1 (hs) tdo / pb2 (hs) artclk / pb3 (hs) it5 / artic1 / pb4 (hs) iccclk / it6 / artic2 / pb5 (hs) it8 / pwm1 / pb7 (hs) v dd v ss oscout oscin iccdata / it7 / pwm0 / pb6 (hs) ain6 / pa6 pc4 / ss / int11 pc5 / miso / it12 pa4 / ain4 pa3 / ain3 / it4 pa2 / ain2 / it3 pa1 / ain1 / it2 pa0 / ain0 / it1 / usboe v ssa usbdm usbvcc v dda v pp reset pc6 / mosi usbdp pa5 / ain5 pc1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 7/132 figure 4. 20-pin so20 package pinout figure 5. 20-pin dip20 package pinout 14 13 12 11 15 16 17 18 oscin oscout pb7 (hs) / pwm1 / it8 pb6 (hs) / pwm0 / it7/ iccdata usbvcc v dd v pp usbdp 1 2 3 4 5 6 7 8 9 10 it3 / ain2 / pa2 pb0 (hs) / mco pb1 (hs) pb2 (hs) pb3 (hs) / artclk pb4 (hs) / artic1 / it5 reset it2 / ain1 / pa1 19 20 usboe/ it1 / ain0/ pa0 v ss usbdm pb5 (hs) / artic2 / it6 / iccclk 14 13 12 11 15 16 17 18 oscin oscout pb7 (hs) / pwm1 / it8 pb6 (hs) / pwm0 / it7/iccdata usbvcc v dd v pp usbdp 1 2 3 4 5 6 7 8 9 10 it5 / artic1 / pb4 (hs) mco / pb0 (hs) pb1 (hs) pb2 (hs) reset it2 / ain1/ pa1 19 20 usboe / it1 / ain0 / pa0 v ss usbdm pb5 (hs) / artic2 / it6 / iccclk it3 / ain2 / pa2 artclk / pb3 (hs) www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 8/132 pin description (contd) legend / abbreviations: type: i = input, o = output, s = supply input level: a = dedicated analog input input level: c = cmos 0.3v dd /0.7v dd , c t = cmos 0.3v dd /0.7v dd with input trigger output level: hs = high sink (on n-buffer only) port configuration capabilities: C input:float = floating, wpu = weak pull-up, int = interrupt (\ =fa lling edge, / =rising edge ) , ana = analog C output: od = open drain, t = true open drain (n buffer 8ma@0.4 v), pp = push-pull table 1. device pin description pin n pin name type level port / control main function (after reset) alternate function tqfp44 dip42 so34 dip32 so20 dip20 input output input output float wpu int ana od pp 1 6 29 28 9 14 v pp sx flash programming voltage (12v), must be tied low in user mode. 2 7 - - - - pd1 i/o c t xx port d1 3 8 - - - - pd0 i/o c t xx port d0 4 9 31 - - - pc7 i/o c t xx port c7 5 10 32 30 - - pc6/mosi i/o c t xx port c6 spi master out / slave in 1) 6 11 33 31 - - pc5/miso/it12 i/o c t xx x port c5 spi master in / slave out 1) / interrupt 12 input 7 12 34 32 - - pc4/ss /it11 i/o c t xx x port c4 spi slave select (active low) 1) / interrupt 11 input 8 13 1 1 - - pc3/sck/it10 i/o c t xx x port c3 spi serial clock 1) / interrupt 10 input 9 14 2 2 - - pc2/it9 i/o c t xx x port c2 interrupt 9 input 10 15 3 3 11 16 oscin these pins are used connect an external clock source to the on- chip main oscillator. 11 16 4 4 12 17 oscout 12175549v ss s digital ground voltage 13 18 6 6 8 13 v dd s digital main power supply volt- age 14 19 7 - - - pc1 i/o c t xt port c1 15 20 - - - - pc0 i/o c t xt port c0 16 21 8 7 13 18 pb7/pwm1/it8/ rx_sez/da- taout/da9 i/o c t hs x \ x port b7 art pwm output 1/ interrupt 8 input 17 - - n.c. not connected www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 9/132 18 22 9 8 14 19 pb6/pwm0/it7/ iccdata i/o c t hs x \ x port b6 art pwm output 0/ interrupt 7 input/in- circuit communica- tion data 19 23 10 9 15 20 pb5/artic2/it6/ iccclk i/o c t hs x / x port b5 art input capture 2/ interrupt 6 input/ in-circuit communi- cation clock 20 24 11 10 16 1 pb4/artic1/it5 i/o c t hs x / x port b4 art input capture 1/interrupt 5 input 21 25 12 11 17 2 pb3/artclk i/o c t hs x x port b3 art clock input 22 26 13 12 18 3 pb2/tdo i/o c t hs x x port b2 sci transmit data output 1) 23 27 14 13 19 4 pb1/rdi i/o c t hs x x port b1 sci receive data input 1) 24 28 15 14 20 5 pb0/mco i/o c t hs x x port b0 cpu clock output 25 29 16 15 - - pa7/ain7 i/o c t xxx port a7 adc analog input 7 26 30 17 16 - - pa6/ain6 i/o c t xxx port a6 adc analog input 6 27 31 18 17 - - pa5/ain5 i/o c t xxx port a5 adc analog input 5 28 32 19 18 - - pa4/ain4 i/o c t xxx port a4 adc analog input 4 29 33 20 19 - - pa3/ain3/it4 i/o c t x\xx port a3 adc analog input 3/ interrupt 4 input 30 34 21 20 1 6 pa2/ain2/it3 i/o c t x\xx port a2 adc analog input 2/ interrupt 3 input 31 35 22 21 2 7 pa1/ain1/it2 i/o c t x\xx port a1 adc analog input 1/ interrupt 2 input 32 36 23 22 3 8 pa0/ain0/it1/ usboe i/o c t x\xx port a0 adc analog input 0/ interrupt 1 input/ usb output enable 33 37 30 29 10 15 reset i/o c top priority non maskable inter- rupt (active low) 34 38 24 23 - - v ssa s analog ground voltage, must be connected externally to v ss . 35 39 25 24 5 10 usbdm i/o usb bidirectional data (data -) 36 40 26 25 6 11 usbdp i/o usb bidirectional data (data +) 37 41 27 26 7 12 usbvcc s usb power supply 3.3v output 38 42 28 27 - - v dda s analog power supply voltage, must be connected externally to v dd . 39 - - - - - reserved must be left unconnected. 40 1 - - - - pd6 i/o c t xx port d6 41 2 - - - - pd5 i/o c t xx port d5 42 3 - - - - pd4 i/o c t xx port d4 pin n pin name type level port / control main function (after reset) alternate function tqfp44 dip42 so34 dip32 so20 dip20 input output input output float wpu int ana od pp www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 10/132 note 1: peripheral not present on all devices. refer to device summary on page 1. 2.1 pcb layout recommendation in the case of dip20 devices the user should lay- out the pcb so that the dip20 st7262 device and the usb connector are centered on the same axis ensuring that the d- and d+ lines are of equal length. refer to figure 6 figure 6. recommended pcb layout for usb interface with dip20 package 43 4 - - - - pd3 i/o c t xx port d3 44 5 - - - - pd2 i/o c t xx port d2 pin n pin name type level port / control main function (after reset) alternate function tqfp44 dip42 so34 dip32 so20 dip20 input output input output float wpu int ana od pp 14 13 12 11 15 16 17 18 usbvcc usbdp 1 2 3 4 5 6 7 8 9 10 19 20 usbdm usb connector ground ground st7262 1.5kohm pull-up resistor www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 11/132 3 register & memory map as shown in the figure 7 , the mcu is capable of addressing 64k bytes of memories and i/o regis- ters. the available memory locations consist of 64 bytes of register locations, 768 bytes of ram and up to 16 kbytes of user program memory. the ram space includes up to 128 bytes for the stack from 0100h to 017fh. the highest address bytes contain the user reset and interrupt vectors. important: memory locations marked as re- served must never be accessed. accessing a re- seved area can have unpredictable effects on the device. figure 7. memory map 0000h program memory interrupt & reset vectors hw registers bfffh 0040h 003fh (see table 2 ) c000h ffdfh ffe0h ffffh (see table 6 ) 0340h reserved 033fh short addressing ram (zero page) or stack 017fh 0040h 00ffh 768 bytes ram e000h 8 kbytes (128 bytes) 16 kbytes 384 bytes ram 64 bytes 01bfh 16-bit addressing ram short addressing ram (zero page) 017fh 0040h 00ffh 448 bytes 033fh 16-bit addressing ram 16-bit addressing ram or stack (128 bytes) 16-bit addressing ram 192 bytes 192 bytes www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 12/132 table 2. hardware register map address block register label register name reset status remarks 0000h 0001h port a padr paddr port a data register port a data direction register 00h 1) 00h r/w 2) r/w 2) 0002h 0003h port b pbdr pbddr port b data register port b data direction register 00h 1) 00h r/w 2) r/w 2) 0004h 0005h port c pcdr pcddr port c data register port c data direction register 00h 1) 00h r/w 2) r/w 2) 0006h 0007h port d pddr pdddr port d data register port d data direction register 00h 1) 00h r/w 2) r/w 2) 0008h itrfre1 interrupt register 1 00h r/w 0009h misc miscellaneous register 00h r/w 000ah 000bh 000ch adc adcdrmsb adcdrlsb adccsr adc data register (bit 9:2) adc data register (bit 1:0) adc control status register 00h 00h 00h read only read only r/w 000dh wdg wdgcr watchdog control register 7fh r/w 000eh 0010h reserved area (3 bytes) 0011h 0012h 0013h spi spidr spicr spicsr spi data i/o register spi control register spi control status register xxh 0xh 00h r/w r/w read only 0014h 0015h 0016h 0017h 0018h 0019h 001ah 001bh 001ch pwm art pwmdcr1 pwmdcr0 pwmcr artcsr artcar artarr articcsr articr1 articr2 pwm ar timer duty cycle register 1 pwm ar timer duty cycle register 0 pwm ar timer control register auto-reload timer control/status register auto-reload timer counter access register auto-reload timer auto-reload register art input capture control/status register art input capture register 1 art input capture register 2 00h 00h 00h 00h 00h 00h 00h 00h 00h r/w r/w r/w r/w r/w r/w r/w read only read only 001dh 001eh 001fh 0020h 0021h 0022h 0023h 0024h sci scierpr scietpr scisr scidr scibrr scicr1 scicr2 sci extended receive prescaler register sci extended transmit prescaler register reserved area sci status register sci data register sci baud rate register sci control register 1 sci control register 2 00h 00h -- c0h xxh 00h x000 0000b 00h r/w r/w read only r/w r/w r/w r/w www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 13/132 legend : x=undefined, r/w=read/write notes : 1. the contents of the i/o port dr registers are readable only in output configuration. in input configura- tion, the values of the i/o pins are returned instead of the dr register contents. 2. the bits associated with unavailable pins must always be kept at their reset value. 0025h 0026h 0027h 0028h 0029h 002ah 002bh 002ch 002dh 002eh 002fh 0030h 0031h usb usbpidr usbdmar usbidr usbistr usbimr usbctlr usbdaddr usbep0ra usbep0rb usbep1ra usbep1rb usbep2ra usbep2rb usb pid register usb dma address register usb interrupt/dma register usb interrupt status register usb interrupt mask register usb control register usb device address register usb endpoint 0 register a usb endpoint 0 register b usb endpoint 1 register a usb endpoint 1 register b usb endpoint 2 register a usb endpoint 2 register b x0h xxh x0h 00h 00h 06h 00h 0000 xxxxb 80h 0000 xxxxb 0000 xxxxb 0000 xxxxb 0000 xxxxb read only r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w 0032h to 0035h reserved area (4 bytes) 0032h 0033h 0034h 0035h itc itspr0 itspr1 itspr2 itspr3 interrupt software priority register 0 interrupt software priority register1 interrupt software priority register 2 interrupt software priority register 3 ffh ffh ffh ffh r/w r/w r/w r/w 0036h 0037h tbu tbucv tbucsr tbu counter value register tbu control/status register 00h 00h r/w r/w 0038h flash fcsr flash control/status register 00h r/w 0039h itrfre2 interrupt register 2 00h r/w 003ah to 003fh reserved area (6 bytes) address block register label register name reset status remarks www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 14/132 4 flash program memory 4.1 introduction the st7 dual voltage high density flash (hdflash) is a non-volatile memory that can be electrically erased as a single block or by individu- al sectors and programmed on a byte-by-byte ba- sis using an external v pp supply. the hdflash devices can be programmed and erased off-board (plugged in a programming tool) or on-board using icp (in-circuit programming) or iap (in-application programming). the array matrix organisation allows each sector to be erased and reprogrammed without affecting other sectors. 4.2 main features n three flash programming modes: C insertion in a programming tool. in this mode, all sectors including option bytes can be pro- grammed or erased. C icp (in-circuit programming). in this mode, all sectors including option bytes can be pro- grammed or erased without removing the de- vice from the application board. C iap (in-application programming) in this mode, all sectors except sector 0, can be pro- grammed or erased without removing the de- vice from the application board and while the application is running. n ict (in-circuit testing) for downloading and executing user application test patterns in ram n read-out protection against piracy n register access security system (rass) to prevent accidental programming or erasing 4.3 structure the flash memory is organised in sectors and can be used for both code and data storage. depending on the overall flash memory size in the microcontroller device, there are up to three user sectors (see table 3 ). each of these sectors can be erased independently to avoid unnecessary erasing of the whole flash memory when only a partial erasing is required. the first two sectors have a fixed size of 4 kbytes (see figure 8 ). they are mapped in the upper part of the st7 addressing space so the reset and in- terrupt vectors are located in sector 0 (f000h- ffffh). table 3. sectors available in flash devices 4.3.1 read-out protection read-out protection, when selected, makes it im- possible to extract the memory content from the microcontroller, thus preventing piracy. even st cannot access the user code. in flash devices, this protection is removed by re- programming the option. in this case, the entire program memory is first automatically erased and the device can be reprogrammed. read-out protection selection depends on the de- vice type: C in flash devices it is enabled and removed through the fmp_r bit in the option byte. C in rom devices it is enabled by mask option specified in the option list. figure 8. memory map and sector address flash size (bytes) available sectors 4k sector 0 8k sectors 0,1 > 8k sectors 0,1, 2 4 kbytes 4 kbytes 2kbytes sector 1 sector 0 16 kbytes sector 2 8k 16k 32k 60k flash ffffh efffh dfffh 3fffh 7fffh 1000h 24 kbytes memory size 8kbytes 40 kbytes 52 kbytes 9fffh bfffh d7ffh 4k 10k 24k 48k www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 15/132 flash program memory (contd) 4.4 icc interface icc needs a minimum of 4 and up to 6 pins to be connected to the programming tool (see figure 9 ). these pins are: C reset : device reset Cv ss : device power supply ground C iccclk: icc output serial clock pin C iccdata: icc input/output serial data pin C iccsel/v pp : programming voltage C osc1(or oscin): main clock input for exter- nal source (optional) Cv dd : application board power supply (option- al, see figure 9 , note 3) figure 9. typical icc interface notes: 1. if the iccclk or iccdata pins are only used as outputs in the application, no signal isolation is necessary. as soon as the programming tool is plugged to the board, even if an icc session is not in progress, the iccclk and iccdata pins are not available for the application. if they are used as inputs by the application, isolation such as a serial resistor has to implemented in case another de- vice forces the signal. refer to the programming tool documentation for recommended resistor val- ues. 2. during the icc session, the programming tool must control the reset pin. this can lead to con- flicts between the programming tool and the appli- cation reset circuit if it drives more than 5ma at high level (push pull output or pull-up resistor<1k). a schottky diode can be used to isolate the appli- cation reset circuit in this case. w hen using a classical rc network with r>1k or a reset man- agement ic with open drain output and pull-up re- sistor>1k, no additional components are needed. in all cases the user must ensure that no external reset is generated by the application during the icc session. 3. the use of pin 7 of the icc connector depends on the programming tool architecture. this pin must be connected when using most st program- ming tools (it is used to monitor the application power supply). please refer to the programming tool manual. 4. pin 9 has to be connected to the osc1 or os- cin pin of the st7 when the clock is not available in the application or if the selected clock option is not programmed in the option byte. st7 devices with multi-oscillator capability need to have osc2 grounded in this case. icc connector iccdata iccclk reset v dd he10 connector type application power supply 1 2 4 6 8 10 97 5 3 programming tool icc connector application board icc cable optional (see note 3) 10k w v ss iccsel/vpp st7 c l2 c l1 osc1 osc2 optional see note 1 see note 2 application reset source application i/o (see note 4) www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 16/132 flash program memory (contd) 4.5 icp (in-circuit programming) to perform icp the microcontroller must be switched to icc (in-circuit communication) mode by an external controller or programming tool. depending on the icp code downloaded in ram, flash memory programming can be fully custom- ized (number of bytes to program, program loca- tions, or selection serial communication interface for downloading). when using an stmicroelectronics or third-party programming tool that supports icp and the spe- cific microcontroller device, the user needs only to implement the icp hardware interface on the ap- plication board (see figure 9 ). for more details on the pin locations, refer to the device pinout de- scription. 4.6 iap (in-application programming) this mode uses a bootloader program previously stored in sector 0 by the user (in icp mode or by plugging the device in a programming tool). this mode is fully controlled by user software. this allows it to be adapted to the user application, (us- er-defined strategy for entering programming mode, choice of communications protocol used to fetch the data to be stored, etc.). for example, it is possible to download code from the spi, sci, usb or can interface and program it in the flash. iap mode can be used to program any of the flash sectors except sector 0, which is write/erase pro- tected to allow recovery in case errors occur dur- ing the programming operation. 4.7 related documentation for details on flash programming and icc proto- col, refer to the st7 flash programming refer- ence manual and to the st7 icc protocol refer- ence manual . 4.8 register description flash control/status register (fcsr) read/write reset value: 0000 0000 (00h) this register is reserved for use by programming tool software. it controls the flash programming and erasing operations. 70 00000000 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 17/132 5 central processing unit 5.1 introduction this cpu has a full 8-bit architecture and contains six internal registers allowing efficient 8-bit data manipulation. 5.2 main features n enable executing 63 basic instructions n fast 8-bit by 8-bit multiply n 17 main addressing modes (with indirect addressing mode) n two 8-bit index registers n 16-bit stack pointer n low power halt and wait modes n priority maskable hardware interrupts n non-maskable software/hardware interrupts 5.3 cpu registers the 6 cpu registers shown in figure 10 are not present in the memory mapping and are accessed by specific instructions. accumulator (a) the accumulator is an 8-bit general purpose reg- ister used to hold operands and the results of the arithmetic and logic calculations and to manipulate data. index registers (x and y) these 8-bit registers are used to create effective addresses or as temporary storage areas for data manipulation. (the cross-assembler generates a precede instruction (pre) to indicate that the fol- lowing instruction refers to the y register.) the y register is not affected by the interrupt auto- matic procedures. program counter (pc) the program counter is a 16-bit register containing the address of the next instruction to be executed by the cpu. it is made of two 8-bit registers pcl (program counter low which is the lsb) and pch (program counter high which is the msb). figure 10. cpu registers accumulator x index register y index register stack pointer condition code register program counter 70 1c 1i1hi0nz reset value = reset vector @ fffeh-ffffh 70 70 70 0 7 15 8 pch pcl 15 8 70 reset value = stack higher address reset value = 1x 11x1xx reset value = xxh reset value = xxh reset value = xxh x = undefined value www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 18/132 central processing unit (contd) condition code register (cc) read/write reset value: 111x1xxx the 8-bit condition code register contains the in- terrupt masks and four flags representative of the result of the instruction just executed. this register can also be handled by the push and pop in- structions. these bits can be individually tested and/or con- trolled by specific instructions. arithmetic management bits bit 4 = h half carry . this bit is set by hardware when a carry occurs be- tween bits 3 and 4 of the alu during an add or adc instructions. it is reset by hardware during the same instructions. 0: no half carry has occurred. 1: a half carry has occurred. this bit is tested using the jrh or jrnh instruc- tion. the h bit is useful in bcd arithmetic subrou- tines. bit 2 = n negative . this bit is set and cleared by hardware. it is repre- sentative of the result sign of the last arithmetic, logical or data manipulation. its a copy of the re- sult 7 th bit. 0: the result of the last operation is positive or null. 1: the result of the last operation is negative (i.e. the most significant bit is a logic 1). this bit is accessed by the jrmi and jrpl instruc- tions. bit 1 = z zero . this bit is set and cleared by hardware. this bit in- dicates that the result of the last arithmetic, logical or data manipulation is zero. 0: the result of the last operation is different from zero. 1: the result of the last operation is zero. this bit is accessed by the jreq and jrne test instructions. bit 0 = c carry/borrow. this bit is set and cleared by hardware and soft- ware. it indicates an overflow or an underflow has occurred during the last arithmetic operation. 0: no overflow or underflow has occurred. 1: an overflow or underflow has occurred. this bit is driven by the scf and rcf instructions and tested by the jrc and jrnc instructions. it is also affected by the bit test and branch, shift and rotate instructions. interrupt management bits bit 5,3 = i1, i0 interrupt the combination of the i1 and i0 bits gives the cur- rent interrupt software priority. these two bits are set/cleared by hardware when entering in interrupt. the loaded value is given by the corresponding bits in the interrupt software pri- ority registers (ixspr). they can be also set/ cleared by software with the rim, sim, iret, halt, wfi and push/pop instructions. see the interrupt management chapter for more details. 70 11i1hi0nz c interrupt software priority i1 i0 level 0 (main) 1 0 level 1 0 1 level 2 0 0 level 3 (= interrupt disable) 1 1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 19/132 cpu registers (contd) stack pointer (sp) read/write reset value: 017fh the stack pointer is a 16-bit register which is al- ways pointing to the next free location in the stack. it is then decremented after data has been pushed onto the stack and incremented before data is popped from the stack (see figure 11 ). since the stack is 128 bytes deep, the 9 most sig- nificant bits are forced by hardware. following an mcu reset, or after a reset stack pointer instruc- tion (rsp), the stack pointer contains its reset val- ue (the sp6 to sp0 bits are set) which is the stack higher address. the least significant byte of the stack pointer (called s) can be directly accessed by a ld in- struction. note: when the lower limit is exceeded, the stack pointer wraps around to the stack upper limit, with- out indicating the stack overflow. the previously stored information is then overwritten and there- fore lost. the stack also wraps in case of an under- flow. the stack is used to save the return address dur- ing a subroutine call and the cpu context during an interrupt. the user may also directly manipulate the stack by means of the push and pop instruc- tions. in the case of an interrupt, the pcl is stored at the first location pointed to by the sp. then the other registers are stored in the next locations as shown in figure 11 . C when an interrupt is received, the sp is decre- mented and the context is pushed on the stack. C on return from interrupt, the sp is incremented and the context is popped from the stack. a subroutine call occupies two locations and an in- terrupt five locations in the stack area. figure 11. stack manipulation example 15 8 00000001 70 1 sp6 sp5 sp4 sp3 sp2 sp1 sp0 pch pcl sp pch pcl sp pcl pch x a cc pch pcl sp pcl pch x a cc pch pcl sp pcl pch x a cc pch pcl sp sp y call subroutine interrupt event push y pop y iret ret or rsp @ 017fh @ 0100h stack higher address = 017fh stack lower address = 0100h www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 20/132 6 clocks and reset 6.1 clock system 6.1.1 general description the mcu accepts either a crystal or ceramic res- onator, or an external clock signal to drive the in- ternal oscillator. the internal clock (f cpu ) is de- rived from the external oscillator frequency (f osc ), by dividing by 3 and multiplying by 2. by setting the osc12/6 bit in the option byte, a 12 mhz external clock can be used giving an internal frequency of 8 mhz while maintaining a 6 mhz clock for usb (re- fer to figure 14 ). the internal clock signal (f cpu ) consists of a square wave with a duty cycle of 50%. it is further divided by 1, 2, 4 or 8 depending on the slow mode selection bits in the miscellaneous register (sms[1:0]) the internal oscillator is designed to operate with an at-cut parallel resonant quartz or ceramic res- onator in the frequency range specified for f osc . the circuit shown in figure 13 is recommended when using a crystal, and table 4 lists the recom- mended capacitors. the crystal and associated components should be mounted as close as pos- sible to the input pins in order to minimize output distortion and start-up stabilization time. table 4. recommended values for 12 mhz crystal resonator note: r smax is the equivalent serial resistor of the crystal (see crystal specification). 6.1.2 external clock input an external clock may be applied to the oscin in- put with the oscout pin not connected, as shown on figure 12 . the t oxov specifications does not apply when using an external clock input. the equivalent specification of the external clock source should be used instead of t oxov (see elec- trical characteristics). 6.1.3 clock output pin (mco) the internal clock (f cpu ) can be output on port b0 by setting the mco bit in the miscellaneous regis- ter. figure 12. external clock source connections figure 13. crystal/ceramic resonator figure 14. clock block diagram r smax 20 w 25 w 70 w c oscin 56pf 47pf 22pf c oscout 56pf 47pf 22pf r p 1-10 m w 1-10 m w 1-10 m w oscin oscout external clock nc oscin oscout c oscin c oscout to cpu and f cpu 8/4/2/1 mhz 6 mhz (usb) 12 or peripherals %2 0 1 osc12/6 6 mhz crystal x2 slow mode % sms[1:0] 1/2/4/8 %3 (or 4/2/1/0.5 mhz) mco pin www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 21/132 6.2 reset the reset procedure is used to provide an orderly software start-up or to exit low power modes. three reset modes are provided: a low voltage re- set, a watchdog reset and an external reset at the reset pin. a reset causes the reset vector to be fetched from addresses fffeh and ffffh in order to be loaded into the pc and with program execution starting from this point. an internal circuitry provides a 514 cpu clock cy- cle delay from the time that the oscillator becomes active. 6.2.1 low voltage reset low voltage reset circuitry generates a reset when v dd is: n below v it+ when v dd is rising, n below v it- when v dd is falling. during low voltage reset, the reset pin is held low, thus permitting the mcu to reset other devices. the low voltage detector can be disabled by set- ting the lvd bit of the option byte. 6.2.2 watchdog reset when a watchdog reset occurs, the r eset pin is pulled low permitting the mcu to reset other devic- es as when low voltage reset ( figure 15 ). 6.2.3 external reset the external reset is an active low input signal ap- plied to the reset pin of the mcu. as shown in figure 18 , the reset signal must stay low for a minimum of one and a half cpu clock cycles. an internal schmitt trigger at the reset pin is pro- vided to improve noise immunity. figure 15. low voltage reset functional diagram figure 16. low voltage reset signal output note : typical hysteresis (v it+ -v it- ) of 250 mv is expected figure 17. temporization timing diagram after an internal reset low voltage v dd from watchdog reset reset internal reset reset reset v dd v it+ v it- v dd addresses $fffe temporization v it+ (514 cpu clock cycles) www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 22/132 figure 18. reset timing diagram note: refer to electrical characteristics for values of t ddr , t oxov , v it+ and v it-. figure 19. reset block diagram note: the output of the external reset circuit must have an open-drain output to drive the st7 reset pad. otherwise the device can be damaged when the st7 generates an internal reset (lvd or watchdog). v dd oscin f cpu ffff fffe pc reset t ddr t oxov 514 cpu clock cycles delay reset r on v dd watchdog reset lvd reset internal reset pulse generator 200ns filter t w(rstl)out + 128 f osc delay www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 23/132 7 interrupts 7.1 introduction the cpu enhanced interrupt management pro- vides the following features: n hardware interrupts n software interrupt (trap) n nested or concurrent interrupt management with flexible interrupt priority and level management: C up to 4 software programmable nesting levels C up to 16 interrupt vectors fixed by hardware C 3 non maskable events: r eset, trap, tli this interrupt management is based on: C bit 5 and bit 3 of the cpu cc register (i1:0), C interrupt software priority registers (isprx), C fixed interrupt vector addresses located at the high addresses of the memory map (ffe0h to ffffh) sorted by hardware priority order. this enhanced interrupt controller guarantees full upward compatibility with the standard (not nest- ed) cpu interrupt controller. 7.2 masking and processing flow the interrupt masking is managed by the i1 and i0 bits of the cc register and the isprx registers which give the interrupt software priority level of each interrupt vector (see table 5 ). the process- ing flow is shown in figure 20 . when an interrupt request has to be serviced: C normal processing is suspended at the end of the current instruction execution. C the pc, x, a and cc registers are saved onto the stack. C i1 and i0 bits of cc register are set according to the corresponding values in the isprx registers of the serviced interrupt vector. C the pc is then loaded with the interrupt vector of the interrupt to service and the first instruction of the interrupt service routine is fetched (refer to interrupt mapping table for vector addresses). the interrupt service routine should end with the iret instruction which causes the contents of the saved registers to be recovered from the stack. note : as a consequence of the iret instruction, the i1 and i0 bits will be restored from the stack and the program in the previous level will resume. table 5. interrupt software priority levels figure 20. interrupt processing flowchart interrupt software priority level i1 i0 level 0 (main) low high 10 level 1 0 1 level 2 0 0 level 3 (= interrupt disable) 1 1 iret restore pc, x, a, cc stack pc, x, a, cc load i1:0 from interrupt sw reg. fetch next reset tli pending instruction i1:0 from stack load pc from interrupt vector y n y n y n interrupt has the same or a lower software priority the interrupt stays pending than current one interrupt has a higher software priority than current one execute instruction interrupt www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 24/132 interrupts (contd) servicing pending interrupts as several interrupts can be pending at the same time, the interrupt to be taken into account is deter- mined by the following two-step process: C the highest software priority interrupt is serviced, C if several interrupts have the same software pri- ority then the interrupt with the highest hardware priority is serviced first. figure 21 describes this decision process. figure 21. priority decision process when an interrupt request is not serviced immedi- ately, it is latched and then processed when its software priority combined with the hardware pri- ority becomes the highest one. note 1 : the hardware priority is exclusive while the software one is not. this allows the previous process to succeed with only one interrupt. note 2 : reset, trap and tli can be considered as having the highest software priority in the deci- sion process. different interrupt vector sources two interrupt source types are managed by the cpu interrupt controller: the non-maskable type (reset, tli, trap) and the maskable type (ex- ternal or from internal peripherals). non-maskable sources these sources are processed regardless of the state of the i1 and i0 bits of the cc register (see figure 20 ). after stacking the pc, x, a and cc registers (except for reset), the corres ponding vector is loaded in the pc register and the i1 and i0 bits of the cc are set to disable interrupts (level 3). these sources allow the processor to exit halt mode. n tli (top level hardware interrupt) this hardware interrupt occurs when a specific edge is detected on the dedicated tli pin. caution : a trap instruction must not be used in a tli service routine. n trap (non maskable software interrupt) this software interrupt is serviced when the trap instruction is executed. it will be serviced accord- ing to the flowchart in figure 20 as a tli. caution: trap can be interrupted by a tli. n reset the reset source has the highest priority in the cpu. this means that the first current routine has the highest software priority (level 3) and the high- est hardware priority. see the reset chapter for more details. maskable sources maskable interrupt vector sources can be serviced if the corresponding interrupt is enabled and if its own interrupt software priority (in isprx registers) is higher than the one currently being serviced (i1 and i0 in cc register). if any of these two condi- tions is false, the interrupt is latched and thus re- mains pending. n external interrupts external interrupts allow the processor to exit from halt low power mode. external interrupt sensitivity is software selectable through the itrfre2 register. external interrupt triggered on edge will be latched and the interrupt request automatically cleared upon entering the interrupt service routine. if several input pins of a group connected to the same interrupt line are selected simultaneously, these will be logically nanded. n peripheral interrupts usually the peripheral interrupts cause the device to exit from halt mode except those mentioned in the interrupt mapping table. a peripheral interrupt occurs when a specific flag is set in the peripheral status registers and if the corresponding enable bit is set in the peripheral control register. the general sequence for clearing an interrupt is based on an access to the status register followed by a read or write to an associated register. note : the clearing sequence resets the internal latch. a pending interrupt (i.e. waiting for being serviced) will therefore be lost if the clear se- quence is executed. pending software different interrupts same highest hardware priority serviced priority highest software priority serviced www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 25/132 interrupts (contd) 7.3 interrupts and low power modes all interrupts allow the processor to exit the wait low power mode. on the contrary, only external and other specified interrupts allow the processor to exit from the halt modes (see column exit from halt in interrupt mapping table). when several pending interrupts are present while exit- ing halt mode, the first one serviced can only be an interrupt with exit from halt mode capability and it is selected through the same decision proc- ess shown in figure 21 . note : if an interrupt, that is not able to exit from halt mode, is pending with the highest priority when exiting halt mode, this interrupt is serviced after the first one serviced. 7.4 concurrent & nested management the following figure 22 and figure 23 show two different interrupt management modes. the first is called concurrent mode and does not allow an in- terrupt to be interrupted, unlike the nested mode in figure 23 . the interrupt hardware priority is given in this order from the lowest to the highest: main, it4, it3, it2, it1, it0, tli. the software priority is given for each interrupt. warning : a stack overflow may occur without no- tifying the software of the failure. figure 22. concurrent interrupt management figure 23. nested interrupt management main it4 it2 it1 tli it1 main it0 i1 hardware priority software 3 3 3 3 3 3/0 3 11 11 11 11 11 11 / 10 11 rim it2 it1 it4 tli it3 it0 it3 i0 10 priority level used stack = 10 bytes main it2 tli main it0 it2 it1 it4 tli it3 it0 hardware priority 3 2 1 3 3 3/0 3 11 00 01 11 11 11 rim it1 it4 it4 it1 it2 it3 i1 i0 11 / 10 10 software priority level used stack = 20 bytes www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 26/132 interrupts (contd) 7.5 interrupt register description cpu cc register interrupt bits read/write reset value: 111x 1010 (xah) bit 5, 3 = i1, i0 software interrupt priority these two bits indicate the current interrupt soft- ware priority. these two bits are set/cleared by hardware when entering in interrupt. the loaded value is given by the corresponding bits in the interrupt software pri- ority registers (isprx). they can be also set/cleared by software with the rim, sim, halt, wfi, iret and push/pop in- structions (see interrupt dedicated instruction set table). *note : tli, trap and r eset events can interrupt a level 3 program. interrupt software priority regis- ters (isprx) read/write (bit 7:4 of ispr3 are read only) reset value: 1111 1111 (ffh) these four registers contain the interrupt software priority of each interrupt vector. C each interrupt vector (except reset and trap) has corresponding bits in these registers where its own software priority is stored. this corre- spondance is shown in the following table. C each i1_x and i0_x bit value in the isprx regis- ters has the same meaning as the i1 and i0 bits in the cc register. C level 0 can not be written (i1_x=1, i0_x=0). in this case, the previously stored value is kept. (ex- ample: previous=cfh, write=64h, result=44h) the reset, trap and tli vectors have no soft- ware priorities. when one is serviced, the i1 and i0 bits of the cc register are both set. *note : bits in the isprx registers which corre- spond to the tli can be read and written but they are not significant in the interrupt process man- agement. caution : if the i1_x and i0_x bits are modified while the interrupt x is executed the following be- haviour has to be considered: if the interrupt x is still pending (new interrupt or flag not cleared) and the new software priority is higher than the previ- ous one, the interrupt x is re-entered. otherwise, the software priority stays unchanged up to the next interrupt request (after the iret of the inter- rupt x). 70 11 i1 h i0 nzc interrupt software priority level i1 i0 level 0 (main) low high 10 level 1 0 1 level 2 0 0 level 3 (= interrupt disable*) 1 1 70 ispr0 i1_3 i0_3 i1_2 i0_2 i1_1 i0_1 i1_0 i0_0 ispr1 i1_7 i0_7 i1_6 i0_6 i1_5 i0_5 i1_4 i0_4 ispr2 i1_11 i0_11 i1_10 i0_10 i1_9 i0_9 i1_8 i0_8 ispr3 1 1 1 1 i1_13 i0_13 i1_12 i0_12 vector address isprx bits fffbh-fffah i1_0 and i0_0 bits* fff9h-fff8h i1_1 and i0_1 bits ... ... ffe1h-ffe0h i1_13 and i0_13 bits www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 27/132 7.6 interrupt register interrupt register 1 (itrfre1) address: 0008h - read/write reset value: 0000 0000 (00h) bit 7:0 = itie interrupt enable 0: i/o pin free for general purpose i/o 1: iti external interrupt enabled. note: the corresponding interrupt is generated when: C a rising edge occurs on the it5/it6 pins C a falling edge occurs on the it1, 2, 3, 4, 7 and 8 pins interrupt register 2 (itrfre2) address: 0039h - read/write reset value: 0000 0000 (00h) bit 7:6 = ctl[3:2] it[12:11] interrupt sensitivity these bits are set and cleared by software. they are used to configure the edge and level sensitivity of the it12 and it11 external interrupt pins (this means that both must have the same sensitivity). bit 5:4 = ctl[1:0] it[10:9]1nterrupt sensitivity these bits are set and cleared by software. they are used to configure the edge and level sensitivity of the it10 and it9 external interrupt pins (this means that both must have the same sensitivity). bit 3:0 = itie interrupt enable 0: i/o pin free for general purpose i/o 1: iti external interrupt enabled. 70 it8e it7e it6e it5e it4e it3e it2e it1e 70 ctl3 ctl2 ctl1 ctl0 it12e it11e it10e it9e ctl3 ctl2 it[12:11] sensitivity 0 0 falling edge and low level 0 1 rising edge only 1 0 falling edge only 1 1 rising and falling edge ctl1 ctl0 it[10:9] sensitivity 0 0 falling edge and low level 0 1 rising edge only 1 0 falling edge only 1 1 rising and falling edge www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 28/132 interrupts (contd) table 6. interrupt mapping table 7. nested interrupts register map and reset values n source block description register label priority order exit from halt address vector reset highest priority lowest priority yes fffeh-ffffh trap software interrupt no fffch-fffdh 0 icp flash start programming nmi interrupt yes fffah-fffbh 1 usb usb end suspend interrupt usbistr yes fff8h-fff9h 2 i/o ports port a external interrupts it[4:1] itrfre1 yes fff6h-fff7h 3 port b external interrupts it[8:5] itrfre1 yes fff4h-fff5h 4 port c external interrupts it[12:9] itrfre2 yes fff2h-fff3h 5 tbu timebase unit interrupt tbucsr no fff0h-fff1h 6 art art/pwm timer interrupt iccsr yes ffeeh-ffefh 7 spi spi interrupt vector spisr yes ffech-ffedh 8 sci sci interrupt vector scisr no ffeah-ffebh 9 usb usb interrupt vector usbistr no ffe8h-ffe9h 10 adc a/d end of conversion interrupt adccsr no ffe6h-ffe7h reserved area ffe0h-ffe5h address (hex.) register label 76543210 0032h ispr0 reset value ext. interrupt port b ext. interrupt port a usb end susp not used i1_3 1 i0_3 1 i1_2 1 i0_2 1 i1_1 1 i0_1 111 0033h ispr1 reset value spi art tbu ext. interrupt port c i1_7 1 i0_7 1 i1_6 1 i0_6 1 i1_5 1 i0_5 1 i1_4 1 i0_4 1 0034h ispr2 reset value not used adc usb sci i1_11 1 i0_11 1 i1_10 1 i0_10 1 i1_9 1 i0_9 1 i1_8 1 i0_8 1 0035h ispr3 reset value1111 not used not used i1_13 1 i0_13 1 i1_12 1 i0_12 1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 29/132 8 power saving modes 8.1 introduction there are three power saving modes. slow mode is selected by setting the sms bits in the miscella- neous register. wait and halt modes may be en- tered using the wfi and halt instructions. after a reset the normal operating mode is se- lected by default (run mode). this mode drives the device (cpu and embedded peripherals) by means of a master clock which is based on the main oscillator frequency divided by 3 and multi- plied by 2 (f cpu ). from run mode, the different power saving modes may be selected by setting the relevant register bits or by calling the specific st7 software instruction whose action depends on the oscillator status. 8.1.1 slow mode in slow mode, the oscillator frequency can be di- vided by a value defined in the miscellaneous register. the cpu and peripherals are clocked at this lower frequency. slow mode is used to reduce power consumption, and enables the user to adapt clock frequency to available supply voltage. 8.2 wait mode wait mode places the mcu in a low power con- sumption mode by stopping the cpu. this power saving mode is selected by calling the wfi st7 software instruction. all peripherals remain active. during wait mode, the i bit of the cc register is forced to 0, to enable all interrupts. all other registers and memory re- main unchanged. the mcu remains in wait mode until an interrupt or reset occurs, whereup- on the program counter branches to the starting address of the interrupt or reset service routine. the mcu will remain in wait mode until a reset or an interrupt occurs, causing it to wake up. refer to figure 24 . figure 24. wait mode flow chart wfi instruction reset interrupt y n n y cpu clock oscillator periph. clock i-bit on on cleared off cpu clock oscillator periph. clock i-bit on on set on fetch reset vector or service interrupt 514 cpu clock cycles delay if reset note: before servicing an interrupt, the cc register is pushed on the stack. the i-bit is set during the inter- rupt routine and cleared when the cc register is popped. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 30/132 power saving modes (contd) 8.3 halt mode the halt mode is the mcu lowest power con- sumption mode. the halt mode is entered by ex- ecuting the halt instruction. the internal oscilla- tor is then turned off, causing all internal process- ing to be stopped, including the operation of the on-chip peripherals. when entering halt mode, the i bit in the condi- tion code register is cleared. thus, any of the ex- ternal interrupts (iti or usb end suspend mode), are allowed and if an interrupt occurs, the cpu clock becomes active. the mcu can exit halt mode on reception of ei- ther an external interrupt on iti, an end suspend mode interrupt coming from usb peripheral, or a reset. the oscillator is then turned on and a stabi- lization time is provided before releasing cpu op- eration. the stabilization time is 514 cpu clock cy- cles. after the start up delay, the cpu continues opera- tion by servicing the interrupt which wakes it up or by fetching the reset vector if a reset wakes it up. figure 25. halt mode flow chart n n external interrupt* reset halt instruction 514 cpu clock fetch reset vector or service interrupt cycles delay cpu clock oscillator periph. clock i-bit on on set on cpu clock oscillator periph. clock i-bit off off cleared off y y note: before servicing an interrupt, the cc register is pushed on the stack. the i-bit is set during the inter- rupt routine and cleared when the cc register is popped. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 31/132 9 i/o ports 9.1 introduction the i/o ports offer different functional modes: transfer of data through digital inputs and outputs and for specific pins: C analog signal input (adc) C alternate signal input/output for the on-chip pe- ripherals. C external interrupt generation an i/o port is composed of up to 8 pins. each pin can be programmed independently as digital input or digital output. 9.2 functional description each port is associated with 2 main registers: C data register (dr) C data direction register (ddr) each i/o pin may be programmed using the corre- sponding register bits in ddr register: bit x corre- sponding to pin x of the port. the same corre- spondence is used for the dr register. table 8. i/o pin functions 9.2.1 input modes the input configuration is selected by clearing the corresponding ddr register bit. in this case, reading the dr register returns the digital value applied to the external i/o pin. notes : 1. all the inputs are triggered by a schmitt trigger. 2. when switching from input mode to output mode, the dr register should be written first to output the correct value as soon as the port is configured as an output. interrupt function when an external interrupt function of an i/o pin, is enabled using the itfre registers, an event on this i/o can generate an external interrupt request to the cpu. the interrupt sensitivity is programma- ble, the options are given in the description of the itrfre interrupt registers. each pin can independently generate an interrupt request. each external interrupt vector is linked to a dedi- cated group of i/o port pins (see interrupts sec- tion). if more than one input pin is selected simul- taneously as interrupt source, this is logically an- ded and inverted. for this reason, if an event oc- curs on one of the interrupt pins, it masks the other ones. 9.2.2 output mode the pin is configured in output mode by setting the corresponding ddr register bit (see table 7). in this mode, writing 0 or 1 to the dr register applies this digital value to the i/o pin through the latch. then reading the dr register returns the previously stored value. note : in this mode, the interrupt function is disa- bled. 9.2.3 alternate functions digital alternate functions when an on-chip peripheral is configured to use a pin, the alternate function is automatically select- ed. this alternate function takes priority over standard i/o programming. when the signal is coming from an on-chip peripheral, the i/o pin is automatically configured in output mode (push-pull or open drain according to the peripheral). when the signal is going to an on-chip peripheral, the i/o pin has to be configured in input mode. in this case, the pin state is also digitally readable by addressing the dr register. notes: 1. input pull-up configuration can cause an unex- pected value at the alternate peripheral input. 2. when the on-chip peripheral uses a pin as input and output, this pin must be configured as an input (ddr = 0). warning : alternate functions of peripherals must must not be activated when the external interrupts are enabled on the same pin, in order to avoid generating spurious interrupts. ddr mode 0 input 1 output www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 32/132 i/o ports (contd) analog alternate functions when the pin is used as an adc input, the i/o must be configured as input. the analog multiplex- er (controlled by the adc registers) switches the analog voltage present on the selected pin to the common analog rail which is connected to the adc input. it is recommended not to change the voltage level or loading on any port pin while conversion is in progress. furthermore it is recommended not to have clocking pins located close to a selected an- alog pin. warning : the analog input voltage level must be within the limits stated in the absolute maximum ratings. 9.2.4 i/o port implementation the hardware implementation on each i/o port de- pends on the settings in the ddr register and spe- cific features of the i/o port such as adc input or true open drain. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 33/132 i/o ports (contd) 9.2.5 port a table 9. port a description figure 26. pa[7:0] configuration port a i/o alternate function input* output signal condition pa0 floating push-pull usboe usboe = 1 (misc) it1 schmitt triggered input it1e = 1 (itrfre1) ain0 (adc) cs[2:0] = 000 (adccsr) pa1 floating push-pull it2 schmitt triggered input it2e = 1 (itrfre1) ain1 (adc) cs[2:0] = 001 (adccsr) pa2 floating push-pull it3 schmitt triggered input it3e = 1 (itrfre1) ain2 (adc) cs[2:0] = 010 (adccsr) pa3 floating push-pull it4 schmitt triggered input it4e = 1 (itrfre1) ain3 (adc) cs[2:0] = 011 (adccsr) pa4 floating push-pull ain4 (adc) cs[2:0] = 100 (adccsr) pa5 floating push-pull ain5 (adc) cs[2:0] = 101 (adccsr) pa6 floating push-pull ain6 (adc) cs[2:0] = 110 (adccsr) pa7 floating push-pull ain7 (adc) cs[2:0] = 111 (adccsr) *reset state dr ddr latch latch dr sel ddr sel v dd pad analog switch analog enable (adc) alternate enable alternate enable digital enable alternate enable alternate alternate input output p-buffer n-buffer 1 0 1 0 v ss data bus common analog rail v dd diodes www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 34/132 i/o ports (contd) 9.2.6 port b table 10. port b description figure 27. port b and port c [7:2] configuration port b i/o alternate function input* output signal condition pb0 floating push-pull (high sink) mco (main clock output) mco = 1 (miscr) pb1 floating push-pull (high sink) rdi sci enabled pb2 floating push-pull (high sink) tdo te = 1 (scicr2) pb3 floating push-pull (high sink) artclk excl = 1 (artcsr) pb4 floating push-pull (high sink) artic1 art timer enabled it5 schmitt triggered input it5e = 1 (itrfre1) pb5 floating push-pull (high sink) artic2 art timer enabled it6 schmitt triggered input it6e = 1 (itrfre1) pb6 floating push-pull (high sink) pwm1 oe0 = 1 (pwmcr) it7 schmitt triggered input it7e = 1 (itrfre1) pb7 floating push-pull (high sink) pwm2 oe1 = 1 (pwmcr) it8 schmitt triggered input it8e = 1 (itrfre1) *reset state dr ddr latch latch dr sel ddr sel v dd pad alternate enable alternate enable alternate enable alternate alternate input output p-buffer n-buffer 1 0 1 0 cmos schmitt trigger v ss v dd diodes data bus pull-up* * pull-up on port c [7:2] only www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 35/132 i/o ports (contd) 9.2.7 port c table 11. port c description figure 28. port c[1:0] configuration port c i/o alternate function input* output signal condition pc0 floating true open drain pc1 floating true open drain pc2 with pull-up push-pull it9 schmitt triggered input it9e = 1 (itrfre2) pc3 with pull-up push-pull sck spi enabled it10 schmitt triggered input it10e = 1 (itrfre2) pc4 with pull-up push-pull ss spi enabled it11 schmitt triggered input it11e = 1 (itrfre2) pc5 with pull-up push-pull miso spi enabled it12 schmitt triggered input it12e = 1 (itrfre2) pc6 with pull-up push-pull mosi spi enabled pc7 with pull-up push-pull *reset state dr ddr latch latch dr sel ddr sel pad alternate enable alternate enable alternate output n-buffer 1 0 1 0 cmos schmitt trigger v ss diodes data bus www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 36/132 i/o ports (contd) 9.2.8 port d table 12. port d description figure 29. port d configuration port d i/o alternate function input* output signal condition pd0 with pull-up push-pull pd1 with pull-up push-pull pd2 with pull-up push-pull pd3 with pull-up push-pull pd4 with pull-up push-pull pd5 with pull-up push-pull pd6 with pull-up push-pull *reset state dr ddr latch latch dr sel ddr sel v dd pad alternate enable alternate enable alternate enable alternate alternate input pull-up output p-buffer n-buffer 1 0 1 0 cmos schmitt trigger v ss v dd data bus diodes www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 37/132 i/o ports (contd) 9.2.9 register description data register (dr) port x data register pxdr with x = a, b, c or d. read/write reset value: 0000 0000 (00h) bits 7:0 = d[7:0] data register 8 bits. the dr register has a specific behaviour accord- ing to the selected input/output configuration. writ- ing the dr register is always taken into account even if the pin is configured as an input; this allows to always have the expected level on the pin when toggling to output mode. reading the dr register returns either the dr register latch content (pin configured as output) or the digital value applied to the i/o pin (pin configured as input). data direction register (ddr) port x data direction register pxddr with x = a, b, c or d. read/write reset value: 0000 0000 (00h) bits 7:0 = dd[7:0] data direction register 8 bits. the ddr register gives the input/output direction configuration of the pins. each bit is set and cleared by software. 0: input mode 1: output mode 70 d7 d6 d5 d4 d3 d2 d1 d0 70 dd7 dd6 dd5 dd4 dd3 dd2 dd1 dd0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 38/132 i/o ports (contd) table 13. i/o port register map and reset values address (hex.) register label 76543210 reset value of all i/o port registers 00000000 0000h padr msb lsb 0001h paddr 0002h pbdr msb lsb 0003h pbddr 0004h pcdr msb lsb 0005h pcddr 0006h pddr msb lsb 0007h pdddr www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 39/132 9.3 miscellaneous register miscellaneous register read write reset value - 0000 0000 (00h) bits 7:4 = reserved bits 3:2 = sms[1:0] slow mode selection these bits select the slow mode frequency (de- pending on the oscillator frequency configured by option byte). bit 1 = usboe usb output enable 0: pa0 port free for general purpose i/o 1: usboe alternate function enabled. the usb output enable signal is output on the pa0 port (at 1 when the st7 usb is transmitting data). bit 0 = mco main clock out 0: pb0 port free for general purpose i/o 1: mco alternate function enabled (f cpu output on pb0 i/o port) 70 - - - - sms1 sms0 us- boe mco osc12/6 sms1 sms0 slow mode frequency (mhz.) f osc = 6 mhz. 00 4 01 2 10 1 1 1 0.5 f osc = 12 mhz. 00 8 01 4 10 2 11 1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 40/132 10 on-chip peripherals 10.1 watchdog timer (wdg) 10.1.1 introduction the watchdog timer is used to detect the occur- rence of a software fault, usually generated by ex- ternal interference or by unforeseen logical condi- tions, which causes the application program to abandon its normal sequence. the watchdog cir- cuit generates an mcu reset on expiry of a pro- grammed time period, unless the program refresh- es the counters contents before the t6 bit be- comes cleared. 10.1.2 main features n programmable free-running downcounter (64 increments of 65536 cpu cycles) n programmable reset n reset (if watchdog activated) when the t6 bit reaches zero n hardware watchdog selectable by option byte 10.1.3 functional description the counter value stored in the cr register (bits t[6:0]), is decremented every 65,536 machine cy- cles, and the length of the timeout period can be programmed by the user in 64 increments. if the watchdog is activated (the wdga bit is set) and when the 7-bit timer (bits t[6:0]) rolls over from 40h to 3fh (t6 becomes cleared), it initiates a reset cycle pulling low the reset pin for typically 500ns. the application program must write in the cr reg- ister at regular intervals during normal operation to prevent an mcu reset. this downcounter is free- running: it counts down even if the watchdog is di- abled the value to be stored in the cr register must be between ffh and c0h (see table 14 ): C the wdga bit is set (watchdog enabled) C the t6 bit is set to prevent generating an imme- diate reset C the t[5:0] bits contain the number of increments which represents the time delay before the watchdog produces a reset. table 14.watchdog timing (f cpu = 8 mhz) figure 30. watchdog block diagram cr register initial value wdg timeout period (ms) max ffh 524.288 min c0h 8.192 reset wdga 7-bit downcounter f cpu t6 t0 clock divider watchdog control register (cr) ? 65536 t1 t2 t3 t4 t5 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 41/132 watchdog timer (contd) 10.1.4 software watchdog option if software watchdog is selected by option byte, the watchdog is disabled following a reset. once activated it cannot be disabled, except by a reset. the t6 bit can be used to generate a software re- set (the wdga bit is set and the t6 bit is cleared). 10.1.5 hardware watchdog option if hardware watchdog is selected by option byte, the watchdog is always active and the wdga bit in the cr is not used. 10.1.6 low power modes wait instruction no effect on watchdog. halt instruction halt mode can be used when the watchdog is en- abled. when the oscillator is stopped, the wdg stops counting and is no longer able to generate a reset until the microcontroller receives an external interrupt or a reset. if an external interrupt is received, the wdg re- starts counting after 514 cpu clocks. in the case of the software watchdog option, if a reset is gen- erated, the wdg is disabled (reset state). recommendations C make sure that an external event is available to wake up the microcontroller from halt mode. C before executing the halt instruction, refresh the wdg counter, to avoid an unexpected wdg reset immediately after waking up the microcon- troller. C when using an external interrupt to wake up the microcontroller, reinitialize the corresponding i/o as input before executing the halt instruction. the main reason for this is that the i/o may be wrongly configured due to external interference or by an unforeseen logical condition. C the opcode for the halt instruction is 0x8e. to avoid an unexpected halt instruction due to a program counter failure, it is advised to clear all occurrences of the data value 0x8e from memo- ry. for example, avoid defining a constant in rom with the value 0x8e. C as the halt instruction clears the i bit in the cc register to allow interrupts, the user may choose to clear all pending interrupt bits before execut- ing the halt instruction. this avoids entering other peripheral interrupt routines after executing the external interrupt routine corresponding to the wake-up event (reset or external interrupt). 10.1.7 interrupts none. 10.1.8 register desc4ription control register (cr) read/write reset value: 0111 1111 (7fh) bit 7 = wdga activation bit . this bit is set by software and only cleared by hardware after a reset. when wdga = 1, the watchdog can generate a reset. 0: watchdog disabled 1: watchdog enabled note: this bit is not used if the hardware watch- dog option is enabled by option byte. bits 6:0 = t[6:0] 7-bit timer (msb to lsb). these bits contain the decremented value. a reset is produced when it rolls over from 40h to 3fh (t6 becomes cleared). table 15. watchdog timer register map and reset values 70 wdga t6 t5 t4 t3 t2 t1 t0 address (hex.) register label 76543210 0dh wdgcr reset value wdga 0 t6 1 t5 1 t4 1 t3 1 t2 1 t1 1 t0 1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 42/132 10.2 pwm auto-reload timer (art) 10.2.1 introduction the pulse width modulated auto-reload timer on-chip peripheral consists of an 8-bit auto reload counter with compare/capture capabilities and of a 7-bit prescaler clock source. these resources allow five possible operating modes: C generation of up to 4 independent pwm signals C output compare and time base interrupt C up to two input capture functions C external event detector C up to two external interrupt sources the three first modes can be used together with a single counter frequency. the timer can be used to wake up the mcu from wait and halt modes. figure 31. pwm auto-reload timer block diagram ovf interrupt excl cc2 cc1 cc0 tce fcrl oie ovf artcsr f input pwmx port function alternate ocrx compare register programmable prescaler 8-bit counter (artcar register) artarr register articrx register load opx polarity control oex pwmcr mux f cpu pwmdcrx register load f counter artclk f ext articx icfx icsx articcsr load icx interrupt iciex input capture control www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 43/132 pwm auto-reload timer (contd) 10.2.2 functional description counter the free running 8-bit counter is fed by the output of the prescaler, and is incremented on every ris- ing edge of the clock signal. it is possible to read or write the contents of the counter on the fly by reading or writing the counter access register (artcar). when a counter overflow occurs, the counter is automatically reloaded with the contents of the artarr register (the prescaler is not affected). counter clock and prescaler the counter clock frequency is given by: f counter = f input / 2 cc[2:0] the timer counters input clock (f input ) feeds the 7-bit programmable prescaler, which selects one of the 8 available taps of the prescaler, as defined by cc[2:0] bits in the control/status register (artcsr). thus the division factor of the prescal- er can be set to 2 n (where n = 0, 1,..7). this f input frequency source is selected through the excl bit of the artcsr register and can be either the f cpu or an external input frequency f ext . the clock input to the counter is enabled by the tce (timer counter enable) bit in the artcsr register. when tce is reset, the counter is stopped and the prescaler and counter contents are frozen. when tce is set, the counter runs at the rate of the selected clock source. counter and prescaler initialization after reset, the counter and the prescaler are cleared and f input = f cpu . the counter can be initialized by: C writing to the artarr register and then setting the fcrl (force counter re-load) and the tce (timer counter enable) bits in the artcsr reg- ister. C writing to the artcar counter access register, in both cases the 7-bit prescaler is also cleared, whereupon counting will start from a known value. direct access to the prescaler is not possible. output compare control the timer compare function is based on four differ- ent comparisons with the counter (one for each pwmx output). each comparison is made be- tween the counter value and an output compare register (ocrx) value. this ocrx register can not be accessed directly, it is loaded from the duty cy- cle register (pwmdcrx) at each overflow of the counter. this double buffering method avoids glitch gener- ation when changing the duty cycle on the fly. figure 32. output compare control counter fdh feh ffh fdh feh ffh fdh feh artarr=fdh f counter ocrx pwmdcrx fdh feh fdh feh ffh pwmx www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 44/132 pwm auto-reload timer (contd) independent pwm signal generation this mode allows up to four pulse width modulat- ed signals to be generated on the pwmx output pins with minimum core processing overhead. this function is stopped during halt mode. each pwmx output signal can be selected inde- pendently using the corresponding oex bit in the pwm control register (pwmcr). when this bit is set, the corresponding i/o pin is configured as out- put push-pull alternate function. the pwm signals all have the same frequency which is controlled by the counter period and the artarr register value. f pwm = f counter / (256 - artarr) when a counter overflow occurs, the pwmx pin level is changed depending on the corresponding opx (output polarity) bit in the pwmcr register. when the counter reaches the value contained in one of the output compare register (ocrx) the corresponding pwmx pin level is restored. it should be noted that the reload values will also affect the value and the resolution of the duty cycle of the pwm output signal. to obtain a signal on a pwmx pin, the contents of the ocrx register must be greater than the contents of the artarr reg- ister. the maximum available resolution for the pwmx duty cycle is: resolution = 1 / (256 - artarr) note : to get the maximum resolution (1/256), the artarr register must be 0. with this maximum resolution, 0% and 100% can be obtained by changing the polarity. figure 33. pwm auto-reload timer function duty cycle register auto-reload register pwmx output t 255 000 with oex=1 and opx=0 (artarr) (pwmdcrx) with oex=1 and opx=1 counter www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 45/132 figure 34. pwm signal from 0% to 100% duty cycle counter pwmx output t with oex=1 and opx=0 fdh feh ffh fdh feh ffh fdh feh ocrx=fch ocrx=fdh ocrx=feh ocrx=ffh artarr=fdh f counter www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 46/132 pwm auto-reload timer (contd) output compare and time base interrupt on overflow, the ovf flag of the artcsr register is set and an overflow interrupt request is generat- ed if the overflow interrupt enable bit, oie, in the artcsr register, is set. the ovf flag must be re- set by the user software. this interrupt can be used as a time base in the application. external clock and event detector mode using the f ext external prescaler input clock, the auto-reload timer can be used as an external clock event detector. in this mode, the artarr register is used to select the n event number of events to be counted before setting the ovf flag. n event = 256 - artarr when entering halt mode while f ext is selected, all the timer control registers are frozen but the counter continues to increment. if the oie bit is set, the next overflow of the counter will generate an interrupt which wakes up the mcu. figure 35. external event detector example (3 counts) counter t fdh feh ffh fdh ovf artcsr read interrupt artarr=fdh f ext =f counter feh ffh fdh if oie=1 interrupt if oie=1 artcsr read www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 47/132 pwm auto-reload timer (contd) input capture function this mode allows the measurement of external signal pulse widths through icrx registers. each input capture can generate an interrupt inde- pendently on a selected input signal transition. this event is flagged by a set of the corresponding cfx bits of the input capture control/status regis- ter (iccsr). these input capture interrupts are enabled through the ciex bits of the iccsr register. the active transition (falling or rising edge) is soft- ware programmable through the csx bits of the iccsr register. the read only input capture registers (icrx) are used to latch the auto-reload counter value when a transition is detected on the articx pin (cfx bit set in iccsr register). after fetching the interrupt vector, the cfx flags can be read to identify the in- terrupt source. note : after a capture detection, data transfer in the icrx register is inhibited until the articcsr register is read (clearing the cfx bit). the timer interrupt remains pending while the cfx flag is set when the interrupt is enabled (ciex bit set). this means, the articcsr register has to be read at each capture event to clear the cfx flag. the timing resolution is given by auto-reload coun- ter cycle time (1/f counter ). during halt mode, input capture is inhibited (the icrx is never re-loaded) and only the external in- terrupt capability can be used. external interrupt capability this mode allows the input capture capabilities to be used as external interrupt sources. the edge sensitivity of the external interrupts is programmable (csx bit of iccsr register) and they are independently enabled through ciex bits of the iccsr register. after fetching the interrupt vector, the cfx flags can be read to identify the in- terrupt source. the interrupts are synchronized on the counter clock rising edge ( figure 36 ). during halt mode, the external interrupts can still be used to wake up the micro (if ciex bit is set). figure 36. art external interrupt figure 37. input capture timing diagram articx pin cfx flag t f counter interrupt counter t 01h f counter xxh 02h 03h 04h 05h 06h 07h 04h articx pin cfx flag icrx register interrupt www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 48/132 pwm auto-reload timer (contd) 10.2.3 register description control / status register (csr) read/write reset value: 0000 0000 (00h) bit 7 = excl external clock this bit is set and cleared by software. it selects the input clock for the 7-bit prescaler. 0: cpu clock. 1: external clock. bit 6:4 = cc[2:0] counter clock control these bits are set and cleared by software. they determine the prescaler division ratio from f input . bit 3 = tce timer counter enable this bit is set and cleared by software. it puts the timer in the lowest power consumption mode. 0: counter stopped (prescaler and counter frozen). 1: counter running. bit 2 = fcrl force counter re-load this bit is write-only and any attempt to read it will yield a logical zero. when set, it causes the contents of arr register to be loaded into the counter, and the content of the prescaler register to be cleared in order to initialize the timer before starting to count. bit 1 = oie overflow interrupt enable this bit is set and cleared by software. it allows to enable/disable the interrupt which is generated when the ovf bit is set. 0: overflow interrupt disable. 1: overflow interrupt enable. bit 0 = ovf overflow flag this bit is set by hardware and cleared by software reading the csr register. it indicates the transition of the counter from ffh to the arr value . 0: new transition not yet reached 1: transition reached counter access register (car) read/write reset value: 0000 0000 (00h) bit 7:0 = ca[7:0] counter access data these bits can be set and cleared either by hard- ware or by software. the car register is used to read or write the auto-reload counter on the fly (while it is counting). auto-reload register (arr) read/write reset value: 0000 0000 (00h) bit 7:0 = ar[7:0] counter auto-reload data these bits are set and cleared by software. they are used to hold the auto-reload value which is au- tomatically loaded in the counter when an overflow occurs. at the same time, the pwm output levels are changed according to the corresponding opx bit in the pwmcr register. this register has two pwm management func- tions: C adjusting the pwm frequency C setting the pwm duty cycle resolution pwm frequency vs. resolution: 70 excl cc2 cc1 cc0 tce fcrl oie ovf f counter with f input =8 mhz cc2 cc1 cc0 f input f input / 2 f input / 4 f input / 8 f input / 16 f input / 32 f input / 64 f input / 128 8 mhz 4 mhz 2 mhz 1 mhz 500 khz 250 khz 125 khz 62.5 khz 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 70 ca7 ca6 ca5 ca4 ca3 ca2 ca1 ca0 70 ar7 ar6 ar5 ar4 ar3 ar2 ar1 ar0 arr value resolution f pwm min max 0 8-bit ~0.244-khz 31.25-khz [ 0..127 ] > 7-bit ~0.244-khz 62.5-khz [ 128..191 ] > 6-bit ~0.488-khz 125-khz [ 192..223 ] > 5-bit ~0.977-khz 250-khz [ 224..239 ] > 4-bit ~1.953-khz 500-khz www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 49/132 pwm auto-reload timer (contd) pwm control register (pwmcr) read/write reset value: 0000 0000 (00h) bit 7:6 = reserved. bit 5:4 = oe[1:0] pwm output enable these bits are set and cleared by software. they enable or disable the pwm output channels inde- pendently acting on the corresponding i/o pin. 0: pwm output disabled. 1: pwm output enabled. bit 3:2 = reserved. bit 1:0 = op[1:0] pwm output polarity these bits are set and cleared by software. they independently select the polarity of the two pwm output signals. notes : C when an opx bit is modified, the pwmx output signal polarity is immediately reversed. C if dcrx=ffh then the output level is always 0. C if dcrx=00h then the output level is always 1. duty cycle registers (dcrx) read/write reset value: 0000 0000 (00h) bit 7:0 = dc[7:0] duty cycle data these bits are set and cleared by software. a dcrx register is associated with the ocrx reg- ister of each pwm channel to determine the sec- ond edge location of the pwm signal (the first edge location is common to all channels and given by the arr register). these dcr registers allow the duty cycle to be set independently for each pwm channel. 70 00oe1oe000op1op0 pwmx output level opx counter <= ocrx counter > ocrx 100 011 70 dc7 dc6 dc5 dc4 dc3 dc2 dc1 dc0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 50/132 pwm auto-reload timer (contd) input capture control / status register (articcsr) read/write (except bits 1:0 read and clear) reset value: 0000 0000 (00h) bit 7:6 = reserved, always read as 0. bit 5:4 = cs[2:1] capture sensitivity these bits are set and cleared by software. they determine the trigger event polarity on the corre- sponding input capture channel. 0: falling edge triggers capture on channel x. 1: rising edge triggers capture on channel x. bit 3:2 = cie[2:1] capture interrupt enable these bits are set and cleared by software. they enable or disable the input capture channel inter- rupts independently. 0: input capture channel x interrupt disabled. 1: input capture channel x interrupt enabled. bit 1:0 = cf[2:1] capture flag these bits are set by hardware when a capture oc- curs and cleared by hardware when software reads the articcsr register. each cfx bit indi- cates that an input capture x has occurred. 0: no input capture on channel x. 1: an input capture has occured on channel x. input capture registers (articrx) read only reset value: 0000 0000 (00h) bit 7:0 = ic[7:0] input capture data these read only bits are set and cleared by hard- ware. an articrx register contains the 8-bit auto-reload counter value transferred by the input capture channel x event. 70 0 0 cs2 cs1 cie2 cie1 cf2 cf1 70 ic7 ic6 ic5 ic4 ic3 ic2 ic1 ic0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 51/132 pwm auto-reload timer (contd) table 16. pwm auto-reload timer register map and reset values address (hex.) register label 7 65432 1 0 0014h pwmdcr1 reset value dc7 0 dc6 0 dc5 0 dc4 0 dc3 0 dc2 0 dc1 0 dc0 0 0015h pwmdcr0 reset value dc7 0 dc6 0 dc5 0 dc4 0 dc3 0 dc2 0 dc1 0 dc0 0 0016h pwmcr reset value 0 0 0 0 oe1 0 oe0 0 0 0 0 0 op1 0 op0 0 0017h artcsr reset value excl 0 cc2 0 cc1 0 cc0 0 tce 0 fcrl 0 oie 0 ovf 0 0018h artcar reset value ca7 0 ca6 0 ca5 0 ca4 0 ca3 0 ca2 0 ca1 0 ca0 0 0019h artarr reset value ar7 0 ar6 0 ar5 0 ar4 0 ar3 0 ar2 0 ar1 0 ar0 0 001ah articcsr reset value 0 0 cs2 0 cs1 0 cie2 0 cie1 0 cf2 0 cf1 0 001bh articr1 reset value ic7 0 ic6 0 ic5 0 ic4 0 ic3 0 ic2 0 ic1 0 ic0 0 001ch articr2 reset value ic7 0 ic6 0 ic5 0 ic4 0 ic3 0 ic2 0 ic1 0 ic0 0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 52/132 10.3 timebase unit (tbu) 10.3.1 introduction the timebase unit (tbu) can be used to generate periodic interrupts. 10.3.2 main features n 8-bit upcounter n programmable prescaler n period between interrupts: max. 8.1ms (at 8 mhz f cpu ) n maskable interrupt n cascadable with pwm/art timer 10.3.3 functional description the tbu operates as a free-running upcounter. when the tcen bit in the tbucsr register is set by software, counting starts at the current value of the tbucv register. the tbucv register is incre- mented at the clock rate output from the prescaler selected by programming the pr[2:0] bits in the tbucsr register. when the counter rolls over from ffh to 00h, the ovf bit is set and an interrupt request is generat- ed if ite is set. the user can write a value at any time in the tbucv register. if the cascading option is selected (cas bit=1 in the tbucsr register), the tbu and the the art timer counters act together as a 16-bit counter. in this case, the tbucv register is the high order byte, the art counter (artcar register) is the low order byte. counting is clocked by the art timer clock (refer to the description of the art timer artcsr register). 10.3.4 programming example in this example, timer is required to generate an in- terrupt after a delay of 1 ms. assuming that f cpu is 8 mhz and a prescaler divi- sion factor of 256 will be programmed using the pr[2:0] bits in the tbucsr register, 1 ms = 32 tbu timer ticks. in this case, the initial value to be loaded in the tbucv must be (256-32) = 224 (e0h). ld a, e0h ld tbucv, a ; initialize counter value ld a 1fh ; ld tbucsr, a ; prescaler factor = 256, ; interrupt enable, ; tbu enable figure 38. tbu block diagram tbu 8-bit upcounter (tbucv register) interrupt request tbu prescaler f cpu tbucsr register pr1 pr0 pr2 tcen ite ovf msb lsb art pwm timer 8-bit counter msb lsb cas 0 1 tbu art timer carry bit 0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 53/132 timebase unit (contd) 10.3.5 low power modes 10.3.6 interrupts note : the ovf interrupt event is connected to an interrupt vector (see interrupts chapter). it generates an interrupt if the ite bit is set in the tbucsr register and the i-bit in the cc register is reset (rim instruction). 10.3.7 register description tbu counter value register (tbucv) read/write reset value: 0000 0000 (00h) bit 7:0 = cv[7:0] counter value this register contains the 8-bit counter value which can be read and written anytime by soft- ware. it is continuously incremented by hardware if tcen=1. tbu control/status register (tbucsr) read/write reset value: 0000 0000 (00h) bit 7 = reserved. forced by hardware to 0 . bit 6 = cas cascading enable this bit is set and cleared by software. it is used to cascade the tbu and the pwm/art timers. 0: cascading disabled 1: cascading enabled bit 5 = ovf overflow flag this bit is set only by hardware, when the counter value rolls over from ffh to 00h. it is cleared by software reading the tbucsr register. writing to this bit does not change the bit value. 0: no overflow 1: counter overflow bit 4 = ite interrupt enabled. this bit is set and cleared by software. 0: overflow interrupt disabled 1: overflow interrupt enabled. an interrupt request is generated when ovf=1. bit 3 = tcen tbu enable. this bit is set and cleared by software. 0: tbu counter is frozen and the prescaler is reset. 1: tbu counter and prescaler running. bit 2:0 = pr[2:0] prescaler selection these bits are set and cleared by software to se- lect the prescaling factor. mode description wait no effect on tbu halt tbu halted. interrupt event event flag enable control bit exit from wait exit from halt counter over- flow event ovf ite yes no 70 cv7 cv6 cv5 cv4 cv3 cv2 cv1 cv0 70 0 cas ovf ite tcen pr2 pr1 pr0 pr2 pr1 pr0 prescaler division factor 000 2 001 4 010 8 011 16 100 32 101 64 110 128 111 256 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 54/132 timebase unit (contd) table 17. tbu register map and reset values address (hex.) register label 76543210 0036h tbucv reset value cv7 0 cv6 0 cv5 0 cv4 0 cv3 0 cv2 0 cv1 0 cv0 0 0037h tbusr reset value - 0 cas 0 ovf 0 ite 0 tcen 0 pr2 0 pr1 0 pr0 0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 55/132 10.4 serial peripheral interface (spi) 10.4.1 introduction the serial peripheral interface (spi) allows full- duplex, synchronous, serial communication with external devices. an spi system may consist of a master and one or more slaves however the spi interface can not be a master in a multi-master system. 10.4.2 main features n full duplex synchronous transfers (on 3 lines) n simplex synchronous transfers (on 2 lines) n master or slave operation n six master mode frequencies (f cpu /4 max.) n f cpu /2 max. slave mode frequency n ss management by software or hardware n programmable clock polarity and phase n end of transfer interrupt flag n write collision, master mode fault and overrun flags 10.4.3 general description figure 39 shows the serial peripheral interface (spi) block diagram. there are 3 registers: C spi control register (spicr) C spi control/status register (spicsr) C spi data register (spidr) the spi is connected to external devices through 3 pins: C miso: master in / slave out data C mosi: master out / slave in data C sck: serial clock out by spi masters and in- put by spi slaves Css : slave select: this input signal acts as a chip select to let the spi master communicate with slaves indi- vidually and to avoid contention on the data lines. slave ss inputs can be driven by stand- ard i/o ports on the master mcu. figure 39. serial peripheral interface block diagram spidr read buffer 8-bit shift register write read data/address bus spi spie spe mstr cpha spr0 spr1 cpol serial clock generator mosi miso ss sck control state spicr spicsr interrupt request master control spr2 0 7 0 7 spif wcol modf 0 ovr ssi ssm sod sod bit ss 1 0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 56/132 serial peripheral interface (contd) 10.4.3.1 functional description a basic example of interconnections between a single master and a single slave is illustrated in figure 40 . the mosi pins are connected together and the miso pins are connected together. in this way data is transferred serially between master and slave (most significant bit first). the communication is always initiated by the mas- ter. when the master device transmits data to a slave device via mosi pin, the slave device re- sponds by sending data to the master device via the miso pin. this implies full duplex communica- tion with both data out and data in synchronized with the same clock signal (which is provided by the master device via the sck pin). to use a single data line, the miso and mosi pins must be connected at each node ( in this case only simplex communication is possible). four possible data/clock timing relationships may be chosen (see figure 43 ) but master and slave must be programmed with the same timing mode. figure 40. single master/ single slave application 8-bit shift register spi clock generator 8-bit shift register miso mosi mosi miso sck sck slave master ss ss +5v msbit lsbit msbit lsbit not used if ss is managed by software www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 57/132 serial peripheral interface (contd) 10.4.3.2 slave select management as an alternative to using the ss pin to control the slave select signal, the application can choose to manage the slave select signal by software. this is configured by the ssm bit in the spicsr regis- ter (see figure 42 ) in software management, the external ss pin is free for other application uses and the internal ss signal level is driven by writing to the ssi bit in the spicsr register. in master mode: Css internal must be held high continuously in slave mode: there are two cases depending on the data/clock timing relationship (see figure 41 ): if cpha=1 (data latched on 2nd clock edge): Css internal must be held low during the entire transmission. this implies that in single slave applications the ss pin either can be tied to v ss , or made free for standard i/o by manag- ing the ss function by software (ssm= 1 and ssi=0 in the in the spicsr register) if cpha=0 (data latched on 1st clock edge): Css internal must be held low during byte transmission and pulled high between each byte to allow the slave to write to the shift reg- ister. if ss is not pulled high, a write collision error will occur when the slave writes to the shift register (see section 10.4.5.3 ). figure 41. generic ss timing diagram figure 42. hardware/software slave select management mosi/miso master ss slave ss (if cpha=0) slave ss (if cpha=1) byte 1 byte 2 byte 3 1 0 ss internal ssm bit ssi bit ss external pin www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 58/132 serial peripheral interface (contd) 10.4.3.3 master mode operation in master mode, the serial clock is output on the sck pin. the clock frequency, polarity and phase are configured by software (refer to the description of the spicsr register). note: the idle state of sck must correspond to the polarity selected in the spicsr register (by pulling up sck if cpol=1 or pulling down sck if cpol=0). to operate the spi in master mode, perform the following two steps in order (if the spicsr register is not written first, the spicr register setting may be not taken into account): 1. write to the spicsr register: C select the clock frequency by configuring the spr[2:0] bits. C select the clock polarity and clock phase by configuring the cpol and cpha bits. figure 43 shows the four possible configurations. note: the slave must have the same cpol and cpha settings as the master. C either set the ssm bit and set the ssi bit or clear the ssm bit and tie the ss pin high for the complete byte transmit sequence. 2. write to the spicr register: C set the mstr and spe bits note: mstr and spe bits remain set only if ss is high). the transmit sequence begins when software writes a byte in the spidr register. 10.4.3.4 master mode transmit sequence when software writes to the spidr register, the data byte is loaded into the 8-bit shift register and then shifted out serially to the mosi pin most sig- nificant bit first. when data transfer is complete: C the spif bit is set by hardware C an interrupt request is generated if the spie bit is set and the interrupt mask in the ccr register is cleared. clearing the spif bit is performed by the following software sequence: 1. an access to the spicsr register while the spif bit is set 2. a read to the spidr register. note: while the spif bit is set, all writes to the spidr register are inhibited until the spicsr reg- ister is read. 10.4.3.5 slave mode operation in slave mode, the serial clock is received on the sck pin from the master device. to operate the spi in slave mode: 1. write to the spicsr register to perform the fol- lowing actions: C select the clock polarity and clock phase by configuring the cpol and cpha bits (see figure 43 ). note: the slave must have the same cpol and cpha settings as the master. C manage the ss pin as described in section 10.4.3.2 and figure 41 . if cpha=1 ss must be held low continuously. if cpha=0 ss must be held low during byte transmission and pulled up between each byte to let the slave write in the shift register. 2. write to the spicr register to clear the mstr bit and set the spe bit to e nable the spi i/o functions. 10.4.3.6 slave mode transmit sequence when software writes to the spidr register, the data byte is loaded into the 8-bit shift register and then shifted out serially to the miso pin most sig- nificant bit first. the transmit sequence begins when the slave de- vice receives the clock signal and the most signifi- cant bit of the data on its mosi pin. when data transfer is complete: C the spif bit is set by hardware C an interrupt request is generated if spie bit is set and interrupt mask in the ccr register is cleared. clearing the spif bit is performed by the following software sequence: 1. an access to the spicsr register while the spif bit is set. 2. a write or a read to the spidr register. notes: while the spif bit is set, all writes to the spidr register are inhibited until the spicsr reg- ister is read. the spif bit can be cleared during a second transmission; however, it must be cleared before the second spif bit in order to prevent an overrun condition (see section 10.4.5.2 ). www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 59/132 serial peripheral interface (contd) 10.4.4 clock phase and clock polarity four possible timing relationships may be chosen by software, using the cpol and cpha bits (see figure 43 ). note: the idle state of sck must correspond to the polarity selected in the spicsr register (by pulling up sck if cpol=1 or pulling down sck if cpol=0). the combination of the cpol clock polarity and cpha (clock phase) bits selects the data capture clock edge figure 43 , shows an spi transfer with the four combinations of the cpha and cpol bits. the di- agram may be interpreted as a master or slave timing diagram where the sck pin, the miso pin, the mosi pin are directly connected between the master and the slave device. note : if cpol is changed at the communication byte boundaries, the spi must be disabled by re- setting the spe bit. figure 43. data clock timing diagram sck msbit bit 6 bit 5 bit 4 bit3 bit 2 bit 1 lsbit msbit bit 6 bit 5 bit 4 bit3 bit 2 bit 1 lsbit miso (from master) mosi (from slave) ss (to slave) capture strobe cpha =1 msbit bit 6 bit 5 bit 4 bit3 bit 2 bit 1 lsbit msbit bit 6 bit 5 bit 4 bit3 bit 2 bit 1 lsbit miso (from master) mosi ss (to slave) capture strobe cpha =0 note: this figure should not be used as a replacement for parametric information. refer to the electrical characteristics chapter. (from slave) (cpol = 1) sck (cpol = 0) sck (cpol = 1) sck (cpol = 0) www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 60/132 serial peripheral interface (contd) 10.4.5 error flags 10.4.5.1 master mode fault (modf) master mode fault occurs when the master device has its ss pin pulled low. when a master mode fault occurs: C the modf bit is set and an spi interrupt re- quest is generated if the spie bit is set. C the spe bit is reset. this blocks all output from the device and disables the spi periph- eral. C the mstr bit is reset, thus forcing the device into slave mode. clearing the modf bit is done through a software sequence: 1. a read access to the spicsr register while the modf bit is set. 2. a write to the spicr register. notes: to avoid any conflicts in an application with multiple slaves, the ss pin must be pulled high during the modf bit clearing sequence. the spe and mstr bits may be restored to their orig- inal state during or after this clearing sequence. hardware does not allow the user to set the spe and mstr bits while the modf bit is set except in the modf bit clearing sequence. in a slave device, the modf bit can not be set, but in a multi master configuration the device can be in slave mode with the modf bit set. the modf bit indicates that there might have been a multi-master conflict and allows software to handle this using an interrupt routine and either perform to a reset or return to an application de- fault state. 10.4.5.2 overrun condition (ovr) an overrun condition occurs, when the master de- vice has sent a data byte and the slave device has not cleared the spif bit issued from the previously transmitted byte. when an overrun occurs: C the ovr bit is set and an interrupt request is generated if the spie bit is set. in this case, the receiver buffer contains the byte sent after the spif bit was last cleared. a read to the spidr register returns this byte. all other bytes are lost. the ovr bit is cleared by reading the spicsr register. 10.4.5.3 write collision error (wcol) a write collision occurs when the software tries to write to the spidr register while a data transfer is taking place with an external device. when this happens, the transfer continues uninterrupted; and the software write will be unsuccessful. write collisions can occur both in master and slave mode. see also section 10.4.3.2 slave select management . note: a "read collision" will never occur since the received data byte is placed in a buffer in which access is always synchronous with the mcu oper- ation. the wcol bit in the spicsr register is set if a write collision occurs. no spi interrupt is generated when the wcol bit is set (the wcol bit is a status flag only). clearing the wcol bit is done through a software sequence (see figure 44 ). figure 44. clearing the wcol bit (write collision flag) software sequence clearing sequence after spif = 1 (end of a data byte transfer) 1st step read spicsr read spidr 2nd step spif =0 wcol=0 clearing sequence before spif = 1 (during a data byte transfer) 1st step 2nd step wcol=0 read spicsr read spidr note: writing to the spidr regis- ter instead of reading it does not reset the wcol bit result result www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 61/132 serial peripheral interface (contd) 10.4.5.4 single master system a typical single master system may be configured, using an mcu as the master and four mcus as slaves (see figure 45 ). the master device selects the individual slave de- vices by using four pins of a parallel port to control the four ss pins of the slave devices. the ss pins are pulled high during reset since the master device ports will be forced to be inputs at that time, thus disabling the slave devices. note: to prevent a bus conflict on the miso line the master allows only one active slave device during a transmission. for more security, the slave device may respond to the master with the received data byte. then the master will receive the previous byte back from the slave device if all miso and mosi pins are con- nected and the slave has not written to its spidr register. other transmission security methods can use ports for handshake lines or data bytes with com- mand fields. figure 45. single master / multiple slave configuration miso mosi mosi mosi mosi mosi miso miso miso miso ss ss ss ss ss sck sck sck sck sck 5v ports slave mcu slave mcu slave mcu slave mcu master mcu www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 62/132 serial peripheral interface (contd) 10.4.6 low power modes 10.4.6.1 using the spi to wakeup the mcu from halt mode in slave configuration, the spi is able to wakeup the st7 device from halt mode through a spif interrupt. the data received is subsequently read from the spidr register when the software is run- ning (interrupt vector fetch). if multiple data trans- fers have been performed before software clears the spif bit, then the ovr bit is set by hardware. note: when waking up from halt mode, if the spi remains in slave mode, it is recommended to per- form an extra communications cycle to bring the spi from halt mode state to normal state. if the spi exits from slave mode, it returns to normal state immediately. caution: the spi can wake up the st7 from halt mode only if the slave select signal (external ss pin or the ssi bit in the spicsr register) is low when the st7 enters halt mode. so if slave selec- tion is configured as external (see section 10.4.3.2 ), make sure the master drives a low level on the ss pin when the slave enters halt mode. 10.4.7 interrupts note : the spi interrupt events are connected to the same interrupt vector (see interrupts chapter). they generate an interrupt if the corresponding enable control bit is set and the interrupt mask in mode description wait no effect on spi. spi interrupt events cause the device to exit from wait mode. halt spi registers are frozen. in halt mode, the spi is inactive. spi oper- ation resumes when the mcu is woken up by an interrupt with exit from halt mode ca- pability. the data received is subsequently read from the spidr register when the soft- ware is running (interrupt vector fetching). if several data are received before the wake- up event, then an overrun error is generated. this error can be detected after the fetch of the interrupt routine that woke up the device. interrupt event event flag enable control bit exit from wait exit from halt spi end of transfer event spif spie yes yes master mode fault event modf yes no overrun error ovr yes no www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 63/132 serial peripheral interface (contd) 10.4.8 register description control register (spicr) read/write reset value: 0000 xxxx (0xh) bit 7 = spie serial peripheral interrupt enable. this bit is set and cleared by software. 0: interrupt is inhibited 1: an spi interrupt is generated whenever spif=1, modf=1 or ovr=1 in the spicsr register bit 6 = spe serial peripheral output enable. this bit is set and cleared by software. it is also cleared by hardware when, in master mode, ss =0 (see section 10.4.5.1 master mode fault (modf) ). the spe bit is cleared by reset, so the spi peripheral is not initially connected to the ex- ternal pins. 0: i/o pins free for general purpose i/o 1: spi i/o pin alternate functions enabled bit 5 = spr2 divider enable . this bit is set and cleared by software and is cleared by reset. it is used with the spr[1:0] bits to set the baud rate. refer to table 18 spi master mode sck frequency . 0: divider by 2 enabled 1: divider by 2 disabled note: this bit has no effect in slave mode. bit 4 = mstr master mode. this bit is set and cleared by software. it is also cleared by hardware when, in master mode, ss =0 (see section 10.4.5.1 master mode fault (modf) ). 0: slave mode 1: master mode. the function of the sck pin changes from an input to an output and the func- tions of the miso and mosi pins are reversed. bit 3 = cpol clock polarity. this bit is set and cleared by software. this bit de- termines the idle state of the serial clock. the cpol bit affects both the master and slave modes. 0: sck pin has a low level idle state 1: sck pin has a high level idle state note : if cpol is changed at the communication byte boundaries, the spi must be disabled by re- setting the spe bit. bit 2 = cpha clock phase. this bit is set and cleared by software. 0: the first clock transition is the first data capture edge. 1: the second clock transition is the first capture edge. note: the slave must have the same cpol and cpha settings as the master. bits 1:0 = spr[1:0] serial clock frequency. these bits are set and cleared by software. used with the spr2 bit, they select the baud rate of the spi serial clock sck output by the spi in master mode. note: these 2 bits have no effect in slave mode. table 18. spi master mode sck frequency 70 spie spe spr2 mstr cpol cpha spr1 spr0 serial clock spr2 spr1 spr0 f cpu /4 1 0 0 f cpu /8 0 0 0 f cpu /16 0 0 1 f cpu /32 1 1 0 f cpu /64 0 1 0 f cpu /128 0 1 1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 64/132 serial peripheral interface (contd) control/status register (spicsr) read/write (some bits read only) reset value: 0000 0000 (00h) bit 7 = spif serial peripheral data transfer flag (read only). this bit is set by hardware when a transfer has been completed. an interrupt is generated if spie=1 in the spicr register. it is cleared by a software sequence (an access to the spicsr register followed by a write or a read to the spidr register). 0: data transfer is in progress or the flag has been cleared. 1: data transfer between the device and an exter- nal device has been completed. note: while the spif bit is set, all writes to the spidr register are inhibited until the spicsr reg- ister is read. bit 6 = wcol write collision status (read only). this bit is set by hardware when a write to the spidr register is done during a transmit se- quence. it is cleared by a software sequence (see figure 44 ). 0: no write collision occurred 1: a write collision has been detected bit 5 = ovr s pi overrun error (read only). this bit is set by hardware when the byte currently being received in the shift register is ready to be transferred into the spidr register while spif = 1 (see section 10.4.5.2 ). an interrupt is generated if spie = 1 in spicsr register. the ovr bit is cleared by software reading the spicsr register. 0: no overrun error 1: overrun error detected bit 4 = modf mode fault flag (read only). this bit is set by hardware when the ss pin is pulled low in master mode (see section 10.4.5.1 master mode fault (modf) ). an spi interrupt can be generated if spie=1 in the spicsr register. this bit is cleared by a software sequence (an ac- cess to the spicsr register while modf=1 fol- lowed by a write to the spicr register). 0: no master mode fault detected 1: a fault in master mode has been detected bit 3 = reserved, must be kept cleared. bit 2 = sod spi output disable. this bit is set and cleared by software. when set, it disables the alternate function of the spi output (mosi in master mode / miso in slave mode) 0: spi output enabled (if spe=1) 1: spi output disabled bit 1 = ssm ss management. this bit is set and cleared by software. when set, it disables the alternate function of the spi ss pin and uses the ssi bit value instead. see section 10.4.3.2 slave select management . 0: hardware management (ss managed by exter- nal pin) 1: software management (internal ss signal con- trolled by ssi bit. external ss pin free for gener- al-purpose i/o) bit 0 = ssi ss internal mode. this bit is set and cleared by software. it acts as a chip select by controlling the level of the ss slave select signal when the ssm bit is set. 0 : slave selected 1 : slave deselected data i/o register (spidr) read/write reset value: undefined the spidr register is used to transmit and receive data on the serial bus. in a master device, a write to this register will initiate transmission/reception of another byte. notes: during the last clock cycle the spif bit is set, a copy of the received data byte in the shift register is moved to a buffer. when the user reads the serial peripheral data i/o register, the buffer is actually being read. while the spif bit is set, all writes to the spidr register are inhibited until the spicsr register is read. warning: a write to the spidr register places data directly into the shift register for transmission. a read to the spidr register returns the value lo- cated in the buffer and not the content of the shift register (see figure 39 ). 70 spif wcol ovr modf - sod ssm ssi 70 d7 d6 d5 d4 d3 d2 d1 d0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 65/132 table 19. spi register map and reset values address (hex.) register label 76543210 0011h spidr reset value msb xxxxxxx lsb x 0012h spicr reset value spie 0 spe 0 spr2 0 mstr 0 cpol x cpha x spr1 x spr0 x 0013h spicsr reset value spif 0 wcol 0 ovr 0 modf 00 sod 0 ssm 0 ssi 0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 66/132 10.5 serial communications interface (sci) 10.5.1 introduction the serial communications interface (sci) offers a flexible means of full-duplex data exchange with external equipment requiring an industry standard nrz asynchronous serial data format. the sci of- fers a very wide range of baud rates using two baud rate generator systems. 10.5.2 main features n full duplex, asynchronous communications n nrz standard format (mark/space) n dual baud rate generator systems n independently programmable transmit and receive baud rates up to 500k baud. n programmable data word length (8 or 9 bits) n receive buffer full, transmit buffer empty and end of transmission flags n two receiver wake-up modes: C address bit (msb) C idle line n muting function for multiprocessor configurations n separate enable bits for transmitter and receiver n four error detection flags: C overrun error C noise error C frame error C parity error n five interrupt sources with flags: C transmit data register empty C transmission complete C receive data register full C idle line received C overrun error detected n parity control: C transmits parity bit C checks parity of received data byte n reduced power consumption mode 10.5.3 general description the interface is externally connected to another device by two pins (see figure 47 ): C tdo: transmit data output. when the transmit- ter and the receiver are disabled, the output pin returns to its i/o port configuration. when the transmitter and/or the receiver are enabled and nothing is to be transmitted, the tdo pin is at high level. C rdi: receive data input is the serial data input. oversampling techniques are used for data re- covery by discriminating between valid incoming data and noise. through these pins, serial data is transmitted and received as frames comprising: C an idle line prior to transmission or reception C a start bit C a data word (8 or 9 bits) least significant bit first C a stop bit indicating that the frame is complete. this interface uses two types of baud rate generator: C a conventional type for commonly-used baud rates, C an extended type with a prescaler offering a very wide range of baud rates even with non-standard oscillator frequencies. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 67/132 serial communications interface (contd) figure 46. sci block diagram wake up unit receiver control sr transmit control tdre tc rdrf idle or nf fe pe sci control interrupt cr1 r8 t8 scid m wake pce ps pie received data register (rdr) received shift register read transmit data register (tdr) transmit shift register write rdi tdo (data register) dr transmitter clock receiver clock receiver rate transmitter rate brr scp1 f cpu control control scp0 sct2 sct1 sct0 scr2 scr1scr0 /pr /16 conventional baud rate generator sbk rwu re te ilie rie tcie tie cr2 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 68/132 serial communications interface (contd) 10.5.4 functional description the block diagram of the serial control interface, is shown in figure 46 . it contains 6 dedicated reg- isters: C two control registers (scicr1 & scicr2) C a status register (scisr) C a baud rate register (scibrr) C an extended prescaler receiver register (scier- pr) C an extended prescaler transmitter register (sci- etpr) refer to the register descriptions in section 10.5.7 for the definitions of each bit. 10.5.4.1 serial data format word length may be selected as being either 8 or 9 bits by programming the m bit in the scicr1 reg- ister (see figure 46 ). the tdo pin is in low state during the start bit. the tdo pin is in high state during the stop bit. an idle character is interpreted as an entire frame of 1s followed by the start bit of the next frame which contains data. a break character is interpreted on receiving 0s for some multiple of the frame period. at the end of the last break frame the transmitter inserts an ex- tra 1 bit to acknowledge the start bit. transmission and reception are driven by their own baud rate generator. figure 47. word length programming bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 bit8 start bit stop bit next start bit idle frame bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 start bit stop bit next start bit start bit idle frame start bit 9-bit word length (m bit is set) 8-bit word length (m bit is reset) possible parity bit possible parity bit break frame start bit extra 1 data frame break frame start bit extra 1 data frame next data frame next data frame www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 69/132 serial communications interface (contd) 10.5.4.2 transmitter the transmitter can send data words of either 8 or 9 bits depending on the m bit status. when the m bit is set, word length is 9 bits and the 9th bit (the msb) has to be stored in the t8 bit in the scicr1 register. character transmission during an sci transmission, data shifts out least significant bit first on the tdo pin. in this mode, the scidr register consists of a buffer (tdr) be- tween the internal bus and the transmit shift regis- ter (see figure 46 ). procedure C select the m bit to define the word length. C select the desired baud rate using the scibrr and the scietpr registers. C set the te bit to assign the tdo pin to the alter- nate function and to send a idle frame as first transmission. C access the scisr register and write the data to send in the scidr register (this sequence clears the tdre bit). repeat this sequence for each data to be transmitted. clearing the tdre bit is always performed by the following software sequence: 1. an access to the scisr register 2. a write to the scidr register the tdre bit is set by hardware and it indicates: C the tdr register is empty. C the data transfer is beginning. C the next data can be written in the scidr regis- ter without overwriting the previous data. this flag generates an interrupt if the tie bit is set and the i bit is cleared in the ccr register. when a transmission is taking place, a write in- struction to the scidr register stores the data in the tdr register and which is copied in the shift register at the end of the current transmission. when no transmission is taking place, a write in- struction to the scidr register places the data di- rectly in the shift register, the data transmission starts, and the tdre bit is immediately set. when a frame transmission is complete (after the stop bit or after the break frame) the tc bit is set and an interrupt is generated if the tcie is set and the i bit is cleared in the ccr register. clearing the tc bit is performed by the following software sequence: 1. an access to the scisr register 2. a write to the scidr register note: the tdre and tc bits are cleared by the same software sequence. break characters setting the sbk bit l oads the shift register with a break character. the break frame length depends on the m bit (see figure 47 ). as long as the sbk bit is set, the sci send break frames to the tdo pin. after clearing this bit by software the sci insert a logic 1 bit at the end of the last break frame to guarantee the recognition of the start bit of the next frame. idle characters setting the te bit drives the sci to send an idle frame before the first data frame. clearing and then setting the te bit during a trans- mission sends an idle frame after the current word. note: resetting and setting the te bit causes the data in the tdr register to be lost. therefore the best time to toggle the te bit is when the tdre bit is set i.e. before writing the next byte in the scidr. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 70/132 serial communications interface (contd) 10.5.4.3 receiver the sci can receive data words of either 8 or 9 bits. when the m bit is set, word length is 9 bits and the msb is stored in the r8 bit in the scicr1 register. character reception during a sci reception, data shifts in least signifi- cant bit first through the rdi pin. in this mode, the scidr register consists or a buffer (rdr) be- tween the internal bus and the received shift regis- ter (see figure 46 ). procedure C select the m bit to define the word length. C select the desired baud rate using the scibrr and the scierpr registers. C set the re bit, this enables the receiver which begins searching for a start bit. when a character is received: C the rdrf bit is set. it indicates that the content of the shift register is transferred to the rdr. C an interrupt is generated if the rie bit is set and the i bit is cleared in the ccr register. C the error flags can be set if a frame error, noise or an overrun error has been detected during re- ception. clearing the rdrf bit is performed by the following software sequence done by: 1. an access to the scisr register 2. a read to the scidr register. the rdrf bit must be cleared before the end of the reception of the next character to avoid an overrun error. break character when a break character is received, the spi han- dles it as a framing error. idle character when a idle frame is detected, there is the same procedure as a data received character plus an in- terrupt if the ilie bit is set and the i bit is cleared in the ccr register. overrun error an overrun error occurs when a character is re- ceived when rdrf has not been reset. data can not be transferred from the shift register to the rdr register as long as the rdrf bit is not cleared. when a overrun error occurs: C the or bit is set. C the rdr content will not be lost. C the shift register will be overwritten. C an interrupt is generated if the rie bit is set and the i bit is cleared in the ccr register. the or bit is reset by an access to the scisr reg- ister followed by a scidr register read operation. noise error oversampling techniques are used for data recov- ery by discriminating between valid incoming data and noise. when noise is detected in a frame: C the nf is set at the rising edge of the rdrf bit. C data is transferred from the shift register to the scidr register. C no interrupt is generated. however this bit rises at the same time as the rdrf bit which itself generates an interrupt. the nf bit is reset by a scisr register read oper- ation followed by a scidr register read operation. framing error a framing error is detected when: C the stop bit is not recognized on reception at the expected time, following either a de-synchroni- zation or excessive noise. C a break is received. when the framing error is detected: C the fe bit is set by hardware C data is transferred from the shift register to the scidr register. C no interrupt is generated. however this bit rises at the same time as the rdrf bit which itself generates an interrupt. the fe bit is reset by a scisr register read oper- ation followed by a scidr register read operation. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 71/132 serial communications interface (contd) figure 48. sci baud rate and extended prescaler block diagram transmitter receiver scietpr scierpr extended prescaler receiver rate control extended prescaler transmitter rate control extended prescaler clock clock receiver rate transmitter rate scibrr scp1 f cpu control control scp0 sct2 sct1 sct0 scr2 scr1scr0 /pr /16 conventional baud rate generator extended receiver prescaler register extended transmitter prescaler register www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 72/132 serial communications interface (contd) 10.5.4.4 conventional baud rate generation the baud rate for the receiver and transmitter (rx and tx) are set independently and calculated as follows: with: pr = 1, 3, 4 or 13 (see scp[1:0] bits) tr = 1, 2, 4, 8, 16, 32, 64,128 (see sct[2:0] bits) rr = 1, 2, 4, 8, 16, 32, 64,128 (see scr[2:0] bits) all these bits are in the scibrr register. example: if f cpu is 8 mhz (normal mode) and if pr=13 and tr=rr=1, the transmit and receive baud rates are 38400 baud. note: the baud rate registers must not be changed while the transmitter or the receiver is en- abled. 10.5.4.5 extended baud rate generation the extended prescaler option gives a very fine tuning on the baud rate, using a 255 value prescal- er, whereas the conventional baud rate genera- tor retains industry standard software compatibili- ty. the extended baud rate generator block diagram is described in the figure 48 . the output clock rate sent to the transmitter or to the receiver will be the output from the 16 divider divided by a factor ranging from 1 to 255 set in the scierpr or the scietpr register. note: the extended prescaler is activated by set- ting the scietpr or scierpr register to a value other than zero. the baud rates are calculated as follows: with: etpr = 1,..,255 (see scietpr register) erpr = 1,.. 255 (see scierpr register) 10.5.4.6 receiver muting and wake-up feature in multiprocessor configurations it is often desira- ble that only the intended message recipient should actively receive the full message contents, thus reducing redundant sci service overhead for all non addressed receivers. the non addressed devices may be placed in sleep mode by means of the muting function. setting the rwu bit by software puts the sci in sleep mode: all the reception status bits can not be set. all the receive interrupts are inhibited. a muted receiver may be awakened by one of the following two ways: C by idle line detection if the wake bit is reset, C by address mark detection if the wake bit is set. receiver wakes-up by idle line detection when the receive line has recognised an idle frame. then the rwu bit is reset by hardware but the idle bit is not set. receiver wakes-up by address mark detection when it received a 1 as the most significant bit of a word, thus indicating that the message is an ad- dress. the reception of this particular word wakes up the receiver, resets the rwu bit and sets the rdrf bit, which allows the receiver to receive this word normally and to use it as an address word. caution : in mute mode, do not write to the scicr2 register. if the sci is in mute mode during the read operation (rwu=1) and a address mark wake up event occurs (rwu is reset) before the write operation, the rwu bit will be set again by this write operation. consequently the address byte is lost and the sci is not woken up from mute mode. tx = (16 * pr) * tr f cpu rx = (16 * pr) * rr f cpu tx = 16 * etpr*(pr*tr) f cpu rx = 16 * erpr*(pr*rr) f cpu www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 73/132 serial communications interface (contd) 10.5.4.7 parity control parity control (generation of parity bit in trasmis- sion and and parity chencking in reception) can be enabled by setting the pce bit in the scicr1 reg- ister. depending on the frame length defined by the m bit, the possible sci frame formats are as listed in table 20 . table 20. frame formats legend: sb = start bit, stb = stop bit, pb = parity bit note : in case of wake up by an address mark, the msb bit of the data is taken into account and not the parity bit even parity: the parity bit is calculated to obtain an even number of 1s inside the frame made of the 7 or 8 lsb bits (depending on whether m is equal to 0 or 1) and the parity bit. ex: data=00110101; 4 bits set => parity bit will be 0 if even parity is selected (ps bit = 0). odd parity: the parity bit is calculated to obtain an odd number of 1s inside the frame made of the 7 or 8 lsb bits (depending on whether m is equal to 0 or 1) and the parity bit. ex: data=00110101; 4 bits set => parity bit will be 1 if odd parity is selected (ps bit = 1). transmission mode: if the pce bit is set then the msb bit of the data written in the data register is not transmitted but is changed by the parity bit. reception mode: if the pce bit is set then the in- terface checks if the received data byte has an even number of 1s if even parity is selected (ps=0) or an odd number of 1s if odd parity is se- lected (ps=1). if the parity check fails, the pe flag is set in the scisr register and an interrupt is gen- erated if pie is set in the scicr1 register. 10.5.5 low power modes 10.5.6 interrupts the sci interrupt events are connected to the same interrupt vector. these events generate an interrupt if the corre- sponding enable control bit is set and the inter- rupt mask in the cc register is reset (rim instruc- tion). m bit pce bit sci frame 0 0 | sb | 8 bit data | stb | 0 1 | sb | 7-bit data | pb | stb | 1 0 | sb | 9-bit data | stb | 1 1 | sb | 8-bit data pb | stb | mode description wait no effect on sci. sci interrupts cause the device to exit from wait mode. halt sci registers are frozen. in halt mode, the sci stops transmit- ting/receiving until halt mode is exit- ed. interrupt event event flag enable control bit exit from wait exit from halt transmit data register empty tdre tie yes no transmission com- plete tc tcie yes no received data ready to be read rdrf rie yes no overrun error detected or yes no idle line detected idle ilie yes no parity error pe pie yes no www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 74/132 serial communications interface (contd) 10.5.7 register description status register (scisr) read only reset value: 1100 0000 (c0h) bit 7 = tdre transmit data register empty. this bit is set by hardware when the content of the tdr register has been transferred into the shift register. an interrupt is generated if the tie bit=1 in the scicr2 register. it is cleared by a software sequence (an access to the scisr register fol- lowed by a write to the scidr register). 0: data is not transferred to the shift register 1: data is transferred to the shift register note: data will not be transferred to the shift reg- ister unless the tdre bit is cleared. bit 6 = tc transmission complete. this bit is set by hardware when transmission of a frame containing data, a preamble or a break is complete. an interrupt is generated if tcie=1 in the scicr2 register. it is cleared by a software se- quence (an access to the scisr register followed by a write to the scidr register). 0: transmission is not complete 1: transmission is complete note: tc is not set after the transmission of a pre- amble or a break. bit 5 = rdrf received data ready flag. this bit is set by hardware when the content of the rdr register has been transferred to the scidr register. an interrupt is generated if rie=1 in the scicr2 register. it is cleared by a software se- quence (an access to the scisr register followed by a read to the scidr register). 0: data is not received 1: received data is ready to be read bit 4 = idle idle line detect. this bit is set by hardware when a idle line is de- tected. an interrupt is generated if the ilie=1 in the scicr2 register. it is cleared by a software se- quence (an access to the scisr register followed by a read to the scidr register). 0: no idle line is detected 1: idle line is detected note: the idle bit will not be set again until the rdrf bit has been set itself (i.e. a new idle line oc- curs). bit 3 = or overrun error. this bit is set by hardware when the word currently being received in the shift register is ready to be transferred into the rdr register while rdrf=1. an interrupt is generated if rie=1 in the scicr2 register. it is cleared by a software sequence (an access to the scisr register followed by a read to the scidr register). 0: no overrun error 1: overrun error is detected note: when this bit is set rdr register content will not be lost but the shift register will be overwritten. bit 2 = nf noise flag. this bit is set by hardware when noise is detected on a received frame. it is cleared by a software se- quence (an access to the scisr register followed by a read to the scidr register). 0: no noise is detected 1: noise is detected note: this bit does not generate interrupt as it ap- pears at the same time as the rdrf bit which it- self generates an interrupt. bit 1 = fe framing error. this bit is set by hardware when a de-synchroniza- tion, excessive noise or a break character is de- tected. it is cleared by a software sequence (an access to the scisr register followed by a read to the scidr register). 0: no framing error is detected 1: framing error or break character is detected note: this bit does not generate interrupt as it ap- pears at the same time as the rdrf bit which it- self generates an interrupt. if the word currently being transferred causes both frame error and overrun error, it will be transferred and only the or bit will be set. bit 0 = pe parity error. this bit is set by hardware when a parity error oc- curs in receiver mode. it is cleared by a software sequence (a read to the status register followed by an access to the scidr data register). an inter- rupt is generated if pie=1 in the scicr1 register. 0: no parity error 1: parity error 70 tdre tc rdrf idle or nf fe pe www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 75/132 serial communications interface (contd) control register 1 (scicr1) read/write reset value: x000 0000 (x0h) bit 7 = r8 receive data bit 8. this bit is used to store the 9th bit of the received word when m=1. bit 6 = t8 transmit data bit 8. this bit is used to store the 9th bit of the transmit- ted word when m=1. bit 5 = scid disabled for low power consumption when this bit is set the sci prescalers and outputs are stopped and the end of the current byte trans- fer in order to reduce power consumption.this bit is set and cleared by software. 0: sci enabled 1: sci prescaler and outputs disabled bit 4 = m word length. this bit determines the word length. it is set or cleared by software. 0: 1 start bit, 8 data bits, 1 stop bit 1: 1 start bit, 9 data bits, 1 stop bit note : the m bit must not be modified during a data transfer (both transmission and reception). bit 3 = wake wake-up method. this bit determines the sci wake-up method, it is set or cleared by software. 0: idle line 1: address mark bit 2 = pce parity control enable. this bit selects the hardware parity control (gener- ation and detection). when the parity control is en- abled, the computed parity is inserted at the msb position (9th bit if m=1; 8th bit if m=0) and parity is checked on the received data. this bit is set and cleared by software. once it is set, pce is active after the current byte (in reception and in transmis- sion). 0: parity control disabled 1: parity control enabled bit 1 = ps parity selection. this bit selects the odd or even parity when the parity generation/detection is enabled (pce bit set). it is set and cleared by software. the parity will be selected after the current byte. 0: even parity 1: odd parity bit 0 = pie parity interrupt enable. this bit enables the interrupt capability of the hard- ware parity control when a parity error is detected (pe bit set). it is set and cleared by software. 0: parity error interrupt disabled 1: parity error interrupt enabled. 70 r8 t8 scid m wake pce ps pie www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 76/132 serial communications interface (contd) control register 2 (scicr2) read/write reset value: 0000 0000 (00h) bit 7 = tie transmitter interrupt enable . this bit is set and cleared by software. 0: interrupt is inhibited 1: an sci interrupt is generated whenever tdre=1 in the scisr register bit 6 = tcie transmission complete interrupt ena- ble this bit is set and cleared by software. 0: interrupt is inhibited 1: an sci interrupt is generated whenever tc=1 in the scisr register bit 5 = rie receiver interrupt enable . this bit is set and cleared by software. 0: interrupt is inhibited 1: an sci interrupt is generated whenever or=1 or rdrf=1 in the scisr register bit 4 = ilie idle line interrupt enable. this bit is set and cleared by software. 0: interrupt is inhibited 1: an sci interrupt is generated whenever idle=1 in the scisr register. bit 3 = te transmitter enable. this bit enables the transmitter. it is set and cleared by software. 0: transmitter is disabled 1: transmitter is enabled notes: C during transmission, a 0 pulse on the te bit (0 followed by 1) sends a preamble (idle line) after the current word. C when te is set there is a 1 bit-time delay before the transmission starts. caution: the tdo pin is free for general purpose i/o only when the te and re bits are both cleared (or if te is never set). bit 2 = re receiver enable. this bit enables the receiver. it is set and cleared by software. 0: receiver is disabled 1: receiver is enabled and begins searching for a start bit bit 1 = rwu receiver wake-up. this bit determines if the sci is in mute mode or not. it is set and cleared by software and can be cleared by hardware when a wake-up sequence is recognized. 0: receiver in active mode 1: receiver in mute mode note: before selecting mute mode (setting the rwu bit), the sci must receive some data first, otherwise it cannot function in mute mode with wakeup by idle line detection. bit 0 = sbk send break. this bit set is used to send break characters. it is set and cleared by software. 0: no break character is transmitted 1: break characters are transmitted note: if the sbk bit is set to 1 and then to 0, the transmitter will send a br eak word at the end of the current word. 70 tie tcie rie ilie te re rwu sbk www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 77/132 serial communications interface (contd) data register (scidr) read/write reset value: undefined contains the received or transmitted data char- acter, depending on whether it is read from or writ- ten to. the data register performs a double function (read and write) since it is composed of two registers, one for transmission (tdr) and one for reception (rdr). the tdr register provides the parallel interface between the internal bus and the output shift reg- ister (see figure 46 ). the rdr register provides the parallel interface between the input shift register and the internal bus (see figure 46 ). baud rate register (scibrr) read/write reset value: 0000 0000 (00h) bits 7:6= scp[1:0] first sci prescaler these 2 prescaling bits allow several standard clock division ranges: bits 5:3 = sct[2:0] sci transmitter rate divisor these 3 bits, in conjunction with the scp1 & scp0 bits define the total division applied to the bus clock to yield the transmit rate clock in convention- al baud rate generator mode. bits 2:0 = scr[2:0] sci receiver rate divisor. these 3 bits, in conjunction with the scp[1:0] bits define the total division applied to the bus clock to yield the receive rate clock in conventional baud rate generator mode. 70 dr7 dr6 dr5 dr4 dr3 dr2 dr1 dr0 70 scp1 scp0 sct2 sct1 sct0 scr2 scr1 scr0 pr prescaling factor scp1 scp0 100 301 410 13 1 1 tr dividing factor sct2 sct1 sct0 1 000 2 001 4 010 8 011 16 100 32 101 64 110 128 1 1 1 rr dividing factor scr2 scr1 scr0 1 000 2 001 4 010 8 011 16 100 32 101 64 110 128 1 1 1 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 78/132 serial communications interface (contd) extended receive prescaler division register (scierpr) read/write reset value: 0000 0000 (00h) allows setting of the extended prescaler rate divi- sion factor for the receive circuit. bits 7:0 = erpr[7:0] 8-bit extended receive prescaler register. the extended baud rate generator is activated when a value different from 00h is stored in this register. therefore the clock frequency issued from the 16 divider (see figure 48 ) is divided by the binary factor set in the scierpr register (in the range 1 to 255). the extended baud rate generator is not used af- ter a reset. extended transmit prescaler division register (scietpr) read/write reset value:0000 0000 (00h) allows setting of the external prescaler rate divi- sion factor for the transmit circuit. bits 7:0 = etpr[7:0] 8-bit extended transmit prescaler register. the extended baud rate generator is activated when a value different from 00h is stored in this register. therefore the clock frequency issued from the 16 divider (see figure 48 ) is divided by the binary factor set in the scietpr register (in the range 1 to 255). the extended baud rate generator is not used af- ter a reset. table 21. baudrate selection 70 erpr 7 erpr 6 erpr 5 erpr 4 erpr 3 erpr 2 erpr 1 erpr 0 70 etpr 7 etpr 6 etpr 5 etpr 4 etpr 3 etpr 2 etpr 1 etpr 0 symbol parameter conditions standard baud rate unit f cpu accuracy vs. standard prescaler f tx f rx communication frequency 8mhz ~0.16% conventional mode tr (or rr)=128, pr=13 tr (or rr)= 32, pr=13 tr (or rr)= 16, pr=13 tr (or rr)= 8, pr=13 tr (or rr)= 4, pr=13 tr (or rr)= 16, pr= 3 tr (or rr)= 2, pr=13 tr (or rr)= 1, pr=13 300 1200 2400 4800 9600 10400 19200 38400 ~300.48 ~1201.92 ~2403.84 ~4807.69 ~9615.38 ~10416.67 ~19230.77 ~38461.54 hz ~0.79% extended mode etpr (or erpr) = 35, tr (or rr)= 1, pr=1 14400 ~14285.71 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 79/132 serial communications interface (contd) table 22. sci register map and reset values address (hex.) register name 76543210 1d scierpr reset value erpr7 0 erpr6 0 erpr5 0 erpr4 0 erpr3 0 erpr2 0 erpr1 0 erpr0 0 1e scietpr reset value etpr7 0 etpr6 0 etpr5 0 etpr4 0 etpr3 0 etpr2 0 etpr1 0 etpr0 0 20 scisr reset value tdre 1 tc 1 rdrf 0 idle 0 or 0 nf 0 fe 0 pe 0 21 scidr reset value dr7 x dr6 x dr5 x dr4 x dr3 x dr2 x dr1 x dr0 x 22 scibrr reset value scp1 0 scp0 0 sct2 0 sct1 0 sct0 0 scr2 0 scr1 0 scr0 0 23 scicr1 reset value r8 x t8 0 scid 0 m 0 wake 0 pce 0 ps 0 pie 0 24 scicr2 reset value tie 0 tcie 0 rie 0 ilie 0 te 0 re 0 rwu 0 sbk 0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 80/132 10.6 usb interface (usb) 10.6.1 introduction the usb interface implements a low-speed func- tion interface between the usb and the st7 mi- crocontroller. it is a highly integrated circuit which includes the transceiver, 3.3 voltage regulator, sie and dma. no external components are needed apart from the external pull-up on usbdm for low speed recognition by the usb host. the use of dma architecture allows the endpoint definition to be completely flexible. endpoints can be config- ured by software as in or out. 10.6.2 main features n usb specification version 1.1 compliant n supports low-speed usb protocol n two or three endpoints (including default one) depending on the device (see device feature list and register map) n crc generation/checking, nrzi encoding/ decoding and bit-stuffing n usb suspend/resume operations n dma data transfers n on-chip 3.3v regulator n on-chip usb transceiver 10.6.3 functional description the block diagram in figure 49 , gives an overview of the usb interface hardware. for general information on the usb, refer to the universal serial bus specifications document available at http//:www.usb.org. serial interface engine the sie (serial interface engine) interfaces with the usb, via the transceiver. the sie processes tokens, handles data transmis- sion/reception, and handshaking as required by the usb standard. it also performs frame format- ting, including crc generation and checking. endpoints the endpoint registers indicate if the microcontrol- ler is ready to transmit/receive, and how many bytes need to be transmitted. dma when a token for a valid endpoint is recognized by the usb interface, the related data transfer takes place, using dma. at the end of the transaction, an interrupt is generated. interrupts by reading the interrupt status register, applica- tion software can know which usb event has oc- curred. figure 49. usb block diagram cpu memory transceiver 3.3v voltage regulator sie endpoint dma interrupt address, and interrupts usbdm usbdp usbvcc 6 mhz registers registers data buses usbgnd www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 81/132 usb interface (contd) 10.6.4 register description dma address register (dmar) read / write reset value: undefined bits 7:0= da[15:8] dma address bits 15-8. software must write the start address of the dma memory area whose most significant bits are given by da15-da6. the remaining 6 address bits are set by hardware. see the description of the idr register and figure 50 . interrupt/dma register (idr) read / write reset value: xxxx 0000 (x0h) bits 7:6 = da[7:6] dma address bits 7-6. software must reset these bits. see the descrip- tion of the dmar register and figure 50 . bits 5:4 = ep[1:0] endpoint number (read-only). these bits identify the endpoint which required at- tention. 00: endpoint 0 01: endpoint 1 10: endpoint 2 when a ctr interrupt occurs (see register istr) the software should read the ep bits to identify the endpoint which has sent or received a packet. bits 3:0 = cnt[3:0] byte count (read only). this field shows how many data bytes have been received during the last data reception. note: not valid for data transmission. figure 50. dma buffers 70 da15 da14 da13 da12 da11 da10 da9 da8 70 da7 da6 ep1 ep0 cnt3 cnt2 cnt1 cnt0 endpoint 0 rx endpoint 0 tx endpoint 2 rx endpoint 1 tx 000000 000111 001000 001111 010000 010111 011000 011111 da15-6,000000 endpoint 1 rx endpoint 2 tx 100000 100111 101000 101111 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 82/132 usb interface (contd) pid register (pidr) read only reset value: xx00 0000 (x0h) bits 7:6 = tp[3:2] token pid bits 3 & 2 . usb token pids are encoded in four bits. tp[3:2] correspond to the variable token pid bits 3 & 2. note: pid bits 1 & 0 have a fixed value of 01. when a ctr interrupt occurs (see register istr) the software should read the tp3 and tp2 bits to retrieve the pid name of the token received. the usb standard defines tp bits as: bits 5:3 reserved. forced by hardware to 0. bit 2 = rx_sez received single-ended zero this bit indicates the status of the rx_sez trans- ceiver output. 0: no se0 (single-ended zero) state 1: usb lines are in se0 (single-ended zero) state bit 1 = rxd received data 0: no k-state 1: usb lines are in k-state this bit indicates the status of the rxd transceiver output (differential receiver output). note: if the environment is noisy, the rx_sez and rxd bits can be used to secure the application. by interpreting the status, software can distinguish a valid end suspend event from a spurious wake-up due to noise on the external usb line. a valid end suspend is followed by a resume or reset se- quence. a resume is indicated by rxd=1, a re- set is indicated by rx_sez=1. bit 0 = reserved. forced by hardware to 0. interrupt status register (istr) read / write reset value: 0000 0000 (00h) when an interrupt occurs these bits are set by hardware. software must read them to determine the interrupt type and clear them after servicing. note: these bits cannot be set by software. bit 7 = susp suspend mode request . this bit is set by hardware when a constant idle state is present on the bus line for more than 3 ms, indicating a suspend mode request from the usb bus. the suspend request check is active immedi- ately after each usb reset event and its disabled by hardware when suspend mode is forced (fsusp bit of ctlr register) until the end of resume sequence. bit 6 = dovr dma over/underrun . this bit is set by hardware if the st7 processor cant answer a dma request in time. 0: no over/underrun detected 1: over/underrun detected bit 5 = ctr correct transfer. this bit is set by hardware when a correct transfer operation is per- formed. the type of transfer can be determined by looking at bits tp3-tp2 in register pidr. the end- point on which the transfer was made is identified by bits ep1-ep0 in register idr. 0: no correct transfer detected 1: correct transfer detected note: a transfer where the device sent a nak or stall handshake is considered not correct (the host only sends ack handshakes). a transfer is considered correct if there are no errors in the pid and crc fields, if the data0/data1 pid is sent as expected, if there were no data overruns, bit stuffing or framing errors. bit 4 = err error. this bit is set by hardware whenever one of the er- rors listed below has occurred: 0: no error detected 1: timeout, crc, bit stuffing or nonstandard framing error detected 70 tp3tp2000 rx_ sez rxd 0 tp3 tp2 pid name 00 out 10 in 1 1 setup 70 susp dovr ctr err iovr esusp reset sof www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 83/132 usb interface (contd) bit 3 = iovr interrupt overrun. this bit is set when hardware tries to set err, or sof before they have been cleared by software. 0: no overrun detected 1: overrun detected bit 2 = esusp end suspend mode . this bit is set by hardware when, during suspend mode, activity is detected that wakes the usb in- terface up from suspend mode. this interrupt is serviced by a specific vector, in or- der to wake up the st7 from halt mode. 0: no end suspend detected 1: end suspend detected bit 1 = reset usb reset. this bit is set by hardware when the usb reset se- quence is detected on the bus. 0: no usb reset signal detected 1: usb reset signal detected note: the daddr, ep0ra, ep0rb, ep1ra, ep1rb, ep2ra and ep2rb registers are reset by a usb reset. bit 0 = sof start of frame. this bit is set by hardware when a low-speed sof indication (keep-alive strobe) is seen on the usb bus. it is also issued at the end of a resume se- quence. 0: no sof signal detected 1: sof signal detected note: to avoid spurious clearing of some bits, it is recommended to clear them using a load instruc- tion where all bits which must not be altered are set, and all bits to be cleared are reset. avoid read- modify-write instructions like and , xor.. interrupt mask register (imr) read / write reset value: 0000 0000 (00h) bits 7:0 = these bits are mask bits for all interrupt condition bits included in the istr. whenever one of the imr bits is set, if the corresponding istr bit is set, and the i bit in the cc register is cleared, an interrupt request is generated. for an explanation of each bit, please refer to the corresponding bit description in istr. control register (ctlr) read / write reset value: 0000 0110 (06h) bits 7:4 = reserved. forced by hardware to 0. bit 3 = resume resume . this bit is set by software to wake-up the host when the st7 is in suspend mode. 0: resume signal not forced 1: resume signal forced on the usb bus. software should clear this bit after the appropriate delay. bit 2 = pdwn power down . this bit is set by software to turn off the 3.3v on- chip voltage regulator that supplies the external pull-up resistor and the transceiver. 0: voltage regulator on 1: voltage regulator off note: after turning on the voltage regulator, soft- ware should allow at least 3 s for stabilisation of the power supply before using the usb interface. bit 1 = fsusp force suspend mode . this bit is set by software to enter suspend mode. the st7 should also be halted allowing at least 600 ns before issuing the halt instruction. 0: suspend mode inactive 1: suspend mode active when the hardware detects usb activity, it resets this bit (it can also be reset by software). bit 0 = fres force reset. this bit is set by software to force a reset of the usb interface, just as if a reset sequence came from the usb. 0: reset not forced 1: usb interface reset forced. the usb is held in reset state until software clears this bit, at which point a usb-reset in- terrupt will be generated if enabled. 70 sus pm dov rm ctr m err m iovr m esu spm res etm sof m 70 0 0 0 0 resume pdwn fsusp fres www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 84/132 usb interface (contd) device address register (daddr) read / write reset value: 0000 0000 (00h) bit 7 = reserved. forced by hardware to 0. bits 6:0 = add[6:0] device address, 7 bits. software must write into this register the address sent by the host during enumeration. note: this register is also reset when a usb reset is received from the usb bus or forced through bit fres in the ctlr register. endpoint n register a (epnra) read / write reset value: 0000 xxxx (0xh) these registers ( ep0ra , ep1ra and ep2ra ) are used for controlling data transmission. they are also reset by the usb bus reset. note : endpoint 2 and the ep2ra register are not available on some devices (see device feature list and register map). bit 7 = st_out status out. this bit is set by software to indicate that a status out packet is expected: in this case, all nonzero out data transfers on the endpoint are stalled instead of being acked. when st_out is reset, out transactions can have any number of bytes, as needed. bit 6 = dtog_tx data toggle, for transmission transfers. it contains the required value of the toggle bit (0=data0, 1=data1) for the next transmitted data packet. this bit is set by hardware at the re- ception of a setup pid. dtog_tx toggles only when the transmitter has received the ack signal from the usb host. dtog_tx and also dtog_rx (see epnrb) are normally updated by hardware, at the receipt of a relevant pid. they can be also written by software. bits 5:4 = stat_tx[1:0] status bits, for transmis- sion transfers. these bits contain the information about the end- point status, which are listed below: these bits are written by software. hardware sets the stat_tx bits to nak when a correct transfer has occurred (ctr=1) related to a in or setup transaction addressed to this endpoint; this allows the software to prepare the next set of data to be transmitted. bits 3:0 = tbc[3:0] transmit byte count for end- point n. before transmission, after filling the transmit buff- er, software must write in the tbc field the trans- mit packet size expressed in bytes (in the range 0- 8). warning: any value outside the range 0-8 will- induce undesired effects (such as continuous data transmission). 70 0 add6 add5 add4 add3 add2 add1 add0 70 st_ out dtog _tx stat _tx1 stat _tx0 tbc 3 tbc 2 tbc 1 tbc 0 stat_tx1 stat_tx0 meaning 00 disabled: transmission transfers cannot be executed. 01 stall : the endpoint is stalled and all transmission requests result in a stall handshake. 10 nak : the endpoint is naked and all transmission requests result in a nak handshake. 11 valid : this endpoint is ena- bled for transmission. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 85/132 usb interface (contd) endpoint n register b (epnrb) read / write reset value: 0000 xxxx (0xh) these registers ( ep1rb and ep2rb ) are used for controlling data reception on endpoints 1 and 2. they are also reset by the usb bus reset. note : endpoint 2 and the ep2rb register are not available on some devices (see device feature list and register map). bit 7 = ctrl control. this bit should be 0. note: if this bit is 1, the endpoint is a control end- point. (endpoint 0 is always a control endpoint, but it is possible to have more than one control end- point). bit 6 = dtog_rx data toggle, for reception trans- fers . it contains the expected value of the toggle bit (0=data0, 1=data1) for the next data packet. this bit is cleared by hardware in the first stage (setup stage) of a control transfer (setup trans- actions start always with data0 pid). the receiv- er toggles dtog_rx only if it receives a correct data packet and the packets data pid matches the receiver sequence bit. bits 5:4 = stat_rx [1:0] status bits, for reception transfers. these bits contain the information about the end- point status, which are listed below: these bits are written by software. hardware sets the stat_rx bits to nak when a correct transfer has occurred (ctr=1) related to an out or set- up transaction addressed to this endpoint, so the software has the time to elaborate the received data before acknowledging a new transaction. bits 3:0 = ea[3:0] endpoint address . software must write in this field the 4-bit address used to identify the transactions directed to this endpoint. usually ep1rb contains 0001 and ep2rb contains 0010. endpoint 0 register b (ep0rb) read / write reset value: 1000 0000 (80h) this register is used for controlling data reception on endpoint 0. it is also reset by the usb bus re- set. bit 7 = forced by hardware to 1. bits 6:4 = refer to the epnrb register for a de- scription of these bits. bits 3:0 = forced by hardware to 0. 70 ctrl dtog _rx stat _rx1 stat _rx0 ea3 ea2 ea1 ea0 stat_rx1 stat_rx0 meaning 00 disabled : reception transfers cannot be exe- cuted. 01 stall: the endpoint is stalled and all reception requests result in a stall handshake. 10 nak : the endpoint is na- ked and all reception re- quests result in a nak handshake. 11 valid : this endpoint is enabled for reception. 70 1 dtog rx stat rx1 stat rx0 0000 stat_rx1 stat_rx0 meaning www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 86/132 usb interface (contd) 10.6.5 programming considerations the interaction between the usb interface and the application program is described below. apart from system reset, action is always initiated by the usb interface, driven by one of the usb events associated with the interrupt status register (is- tr) bits. 10.6.5.1 initializing the registers at system reset, the software must initialize all reg- isters to enable the usb interface to properly gen- erate interrupts and dma requests. 1. initialize the dmar, idr, and imr registers (choice of enabled interrupts, address of dma buffers). refer the paragraph titled initializing the dma buffers. 2. initialize the ep0ra and ep0rb registers to enable accesses to address 0 and endpoint 0 to support usb enumeration. refer to the para- graph titled endpoint initialization. 3. when addresses are received through this channel, update the content of the daddr. 4. if needed, write the endpoint numbers in the ea fields in the ep1rb and ep2rb register. 10.6.5.2 initializing dma buffers the dma buffers are a contiguous zone of memo- ry whose maximum size is 48 bytes. they can be placed anywhere in the memory space to enable the reception of messages. the 10 most signifi- cant bits of the start of this memory area are spec- ified by bits da15-da6 in registers dmar and idr, the remaining bits are 0. the memory map is shown in figure 50 . each buffer is filled starting from the bottom (last 3 address bits=000) up. 10.6.5.3 endpoint initialization to be ready to receive: set stat_rx to valid (11b) in ep0rb to enable reception. to be ready to transmit: 1. write the data in the dma transmit buffer. 2. in register epnra, specify the number of bytes to be transmitted in the tbc field 3. enable the endpoint by setting the stat_tx bits to valid (11b) in epnra. note: once transmission and/or reception are en- abled, registers epnra and/or epnrb (respec- tively) must not be modified by software, as the hardware can change their value on the fly. when the operation is completed, they can be ac- cessed again to enable a new operation. 10.6.5.4 interrupt handling start of frame (sof) the interrupt service routine may monitor the sof events for a 1 ms synchronization event to the usb bus. this interrupt is generated at the end of a resume sequence and can also be used to de- tect this event. usb reset (r eset) when this event occurs, the daddr register is re- set, and communication is disabled in all endpoint registers (the usb interface will not respond to any packet). software is responsible for reenabling endpoint 0 within 10 ms of the end of reset. to do this, set the stat_rx bits in the ep0rb register to valid. suspend (susp) the cpu is warned about the lack of bus activity for more than 3 ms, which is a suspend request. the software should set the usb interface to sus- pend mode and execute an st7 halt instruction to meet the usb-specified power constraints. end suspend (esusp) the cpu is alerted by activity on the usb, which causes an esusp interrupt. the st7 automatical- ly terminates halt mode. correct transfer (ctr) 1. when this event occurs, the hardware automat- ically sets the stat_tx or stat_rx to nak. note: every valid endpoint is naked until soft- ware clears the ctr bit in the istr register, independently of the endpoint number addressed by the transfer which generated the ctr interrupt. note: if the event triggering the ctr interrupt is a setup transaction, both stat_tx and stat_rx are set to nak. 2. read the pidr to obtain the token and the idr to get the endpoint number related to the last transfer. note: when a ctr interrupt occurs, the tp3- tp2 bits in the pidr register and ep1-ep0 bits in the idr register stay unchanged until the ctr bit in the istr register is cleared. 3. clear the ctr bit in the istr register. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 87/132 usb interface (contd) table 23. usb register map and reset values address (hex.) register name 7 6 5 4 3210 25 pidr reset value tp3 x tp2 x 0 0 0 0 0 0 rx_sez 0 rxd 0 0 0 26 dmar reset value da15 x da14 x da13 x da12 x da11 x da10 x da9 x da8 x 27 idr reset value da7 x da6 x ep1 x ep0 x cnt3 0 cnt2 0 cnt1 0 cnt0 0 28 istr reset value susp 0 dovr 0 ctr 0 err 0 iovr 0 esusp 0 reset 0 sof 0 29 imr reset value suspm 0 dovrm 0 ctrm 0 errm 0 iovrm 0 esuspm 0 resetm 0 sofm 0 2a ctlr reset value 0 0 0 0 0 0 0 0 resume 0 pdwn 1 fsusp 1 fres 0 2b daddr reset value 0 0 add6 0 add5 0 add4 0 add3 0 add2 0 add1 0 add0 0 2c ep0ra reset value st_out 0 dtog_tx 0 stat_tx1 0 stat_tx0 0 tbc3 x tbc2 x tbc1 x tbc0 x 2d ep0rb reset value 1 1 dtog_rx 0 stat_rx1 0 stat_rx0 0 0 0 0 0 0 0 0 0 2e ep1ra reset value st_out 0 dtog_tx 0 stat_tx1 0 stat_tx0 0 tbc3 x tbc2 x tbc1 x tbc0 x 2f ep1rb reset value ctrl 0 dtog_rx 0 stat_rx1 0 stat_rx0 0 ea3 x ea2 x ea1 x ea0 x 30 ep2ra reset value st_out 0 dtog_tx 0 stat_tx1 0 stat_tx0 0 tbc3 x tbc2 x tbc1 x tbc0 x 31 ep2rb reset value ctrl 0 dtog_rx 0 stat_rx1 0 stat_rx0 0 ea3 x ea2 x ea1 x ea0 x www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 88/132 10.7 10-bit a/d converter (adc) 10.7.1 introduction the on-chip analog to digital converter (adc) pe- ripheral is a 10-bit, successive approximation con- verter with internal sample and hold circuitry. this peripheral has up to 8 multiplexed analog input channels (refer to device pin out description) that allow the peripheral to convert the analog voltage levels from up to 8 different sources. the result of the conversion is stored in a 10-bit data register. the a/d converter is controlled through a control/status register. 10.7.2 main features n 10-bit conversion n up to 8 channels with multiplexed input n linear successive approximation n data register (dr) which contains the results n conversion complete status flag n continuous or one-shot mode n on/off bit (to reduce consumption) the block diagram is shown in figure 51 . 10.7.3 functional description 10.7.3.1 analog power supply depending on the mcu pin count, the package may feature separate v dda and v ssa analog pow- er supply pins. these pins supply power to the a/d converter cell and function as the high and low ref- erence voltages for the conversion. in smaller packages v dda and v ssa pins are not available and the analog supply and reference pads are in- ternally bonded to the v dd and v ss pins. separation of the digital and analog power pins al- low board designers to improve a/d performance. conversion accuracy can be impacted by voltage drops and noise in the event of heavily loaded or badly decoupled power supply lines. 10.7.3.2 pcb design guidelines to obtain best results, some general design and layout rules should be followed when designing the application pcb to shield the the noise-sensi- tive, analog physical interface from noise-generat- ing cmos logic signals. C use separate digital and analog planes. the an- alog ground plane should be connected to the digital ground plane via a single point on the pcb. the analog power plane should be con- nected to the digital power plane via an rc net- work. C filter power to the analog power planes. the best solution is to connect a 0.1f capacitor, with good high frequency characteristics, between v dda and v ssa and place it as close as possible to the v dda and v ssa pins and connect the ana- log and digital power supplies in a star network. do not use a resistor, as v dda is used as a refer- ence voltage by the a/d converter and resist- ance would cause a voltage drop and a loss of accuracy. C properly place components and route the signal traces on the pcb to shield the analog inputs. analog signals paths should run over the analog ground plane and be as short as possible. isolate analog signal from digital signals that may switch while the analog inputs are being sampled by the a/d converter. do not toggle digital outputs on the same i/o port as the a/d input being convert- ed. 10.7.3.3 digital a/d conversion result the conversion is monotonic, meaning that the re- sult never decreases if the analog input does not and never increases if the analog input does not. if the input voltage (v ain ) is greater than v dda (high-level voltage reference) then the conversion result is ffh in the adcdrmsb register and 03h in the adcdrlsb register (without overflow indi- cation). if the input voltage (v ain ) is lower than v ssa (low- level voltage reference) then the conversion result in the adcdrmsb and adcdrlsb registers is 00 00h. the a/d converter is linear and the digital result of the conversion is stored in the adcdrmsb and adcdrlsb registers. the accuracy of the con- version is described in the electrical characteris- tics section. r ain is the maximum recommended impedance for an analog input signal. if the impedance is too high, this will result in a loss of accuracy due to leakage and sampling not being completed in the alloted time. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 89/132 10-bit a/d converter (adc) (contd) 10.7.3.4 a/d conversion conversion can be performed in one-shot or con- tinuous mode. continuous mode is typically used for monitoring a single channel. one-shot mode should be used when the application requires in- puts from several channels. adc configuration the analog input ports must be configured as in- put, no pull-up, no interrupt. refer to the ?i/o ports? chapter. using these pins as analog inputs does not affect the ability of the port to be read as a logic input. in the adccsr register: C select the cs[2:0] bits to assign the analog channel to convert. adc one-shot conversion mode in the adccsr register: 1.set the one shot bit to put the a/d converter in one shot mode. 2.set the adon bit to enable the a/d converter and to start the conversion. the eoc bit is kept low by hardware during the conversion. note: changing the a/d channel during conver- sion will stop the current conversion and start con- version of the newly selected channel. when a conversion is complete: C the eoc bit is set by hardware. C an interrupt request is generated if the ite bit is set. C the adon bit is reset by hardware. C the result is in the adcdr registers. to read the 10 bits, perform the following steps: 1. wait for interrupt or poll the eoc bit 2. read adcdrlsb 3. read adcdrmsb the eoc bit is reset by hardware once the ad- cdrmsb is read. figure 51. adc block diagram cs2 cs1 eoc speed adon ite cs0 adccsr ain0 ain1 analog to digital converter ainx analog mux d4 d3 d5 d9 d8 d7 d6 d2 adcdrmsb 3 div 2 f adc f cpu d1 d0 adcdrlsb div 4 0 1 eoc interrupt 00 0000 one shot www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 90/132 10-bit a/d converter (adc) (contd) to read only 8 bits, perform the following steps: 1. wait for interrupt or poll the eoc bit 2. read adcdrmsb the eoc bit is reset by hardware once the ad- cdrmsb is read. to start another conversion, user should set the adon bit once again. adc continuous conversion mode in the adccsr register: 1.reset the one shot bit to put the a/d con- verter in continuous mode. 2.set the adon bit to enable the a/d converter and to start the first conversion. from this time on, the adc performs a continuous conversion of the selected channel. note: changing the a/d channel during conver- sion will stop the current conversion and start con- version of the newly selected channel. when a conversion is complete: C the eoc bit is set by hardware. C an interrupt request is generated if the ite bit is set. C the result is in the adcdr registers and re- mains valid until the next conversion has end- ed. to read the 10 bits, perform the following steps: 1. wait for interrupt or poll the eoc bit 2. read adcdrlsb 3. read adcdrmsb the eoc bit is reset by hardware once the ad- cdrmsb is read. to read only 8 bits, perform the following steps: 1. wait for interrupt 2. read adcdrmsb the eoc bit is reset by hardware once the ad- cdrmsb is read. changing the conversion channel the application can change channels during con- version. in this case the current conversion is stopped and the a/d converter starts converting the newly selected channel. adccr consistency if an end of conversion event occurs after soft- ware has read the adcdrlsb but before it has read the adcdrmsb, there would be a risk that the two values read would belong to different sam- ples. to guarantee consistency: C the adcdrmsb and the adcdrlsb are locked when the adccrlsb is read C the adcdrmsb and the adcdrlsb are un- locked when the msb is read or when adon is reset. thus, it is mandatory to read the adcdrmsb just after reading the adcdrlsb. this is especially important in continuous mode, as the adcdr reg- ister will not be updated until the adcdrmsb is read. 10.7.4 low power modes note: the a/d converter may be disabled by re- setting the adon bit. this feature allows reduced power consumption when no conversion is need- ed and between single shot conversions. 10.7.5 interrupts note : the eoc interrupt event is connected to an interrupt vector (see interrupts chapter). it generates an interrupt if the ite bit is set in the adccsr register and the interrupt mask in the cc register is reset (rim instruction). mode description wait no effect on a/d converter halt a/d converter disabled. after wakeup from halt mode, the a/d converter requires a stabilisation time t stab (see electrical characteristics) before accurate conversions can be performed. interrupt event event flag enable control bit exit from wait exit from halt end of conversion eoc ite yes no www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 91/132 10-bit a/d converter (adc) (contd) 10.7.6 register description control/status register (adccsr) read/write (except bit 7 read only) reset value: 0000 0000 (00h) bit 7 = eoc end of conversion this bit is set by hardware. it is cleared by soft- ware reading the adcdrmsb register. 0: conversion is not complete 1: conversion complete bit 6 = speed adc clock selection this bit is set and cleared by software. 0: f adc = f cpu /2 1: f adc = f cpu /4 bit 5 = adon a/d converter on this bit is set and cleared by software or by hard- ware after the end of a one shot conversion. 0: disable adc and stop conversion 1: enable adc and start conversion bit 4 = ite interrupt enable this bit is set and cleared by software. 0: eoc interrupt disabled 1: eoc interrupt enabled bit 3 = oneshot one shot conversion selection this bit is set and cleared by software. 0: continuous conversion mode 1: one shot conversion mode bit 2:0 = cs[2:0] channel selection these bits are set and cleared by software. they select the analog input to convert. *the number of channels is device dependent. refer to the device pinout description. data register (adcdrmsb) read only reset value: 0000 0000 (00h) bit 7:0 = d[9:2] msb of analog converted value this register contains the msb of the converted analog value. data register (adcdrlsb) read only reset value: 0000 0000 (00h) bit 7:2 = reserved. forced by hardware to 0. bit 1:0 = d[1:0] lsb of analog converted value this register contains the lsb of the converted an- alog value. 70 eoc speed adon ite one shot cs2 cs1 cs0 channel* cs2 cs1 cs0 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111 70 d9 d8 d7 d6 d5 d4 d3 d2 70 000000d1d0 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 92/132 11 instruction set 11.1 cpu addressing modes the cpu features 17 different addressing modes which can be classified in 7 main groups: the cpu instruction set is designed to minimize the number of bytes required per instruction: to do so, most of the addressing modes may be subdi- vided in two sub-modes called long and short: C long addressing mode is more powerful be- cause it can use the full 64 kbyte address space, however it uses more bytes and more cpu cy- cles. C short addressing mode is less powerful because it can generally only access page zero (0000h - 00ffh range), but the instruction size is more compact, and faster. all memory to memory in- structions use short addressing modes only (clr, cpl, neg, bset, bres, btjt, btjf, inc, dec, rlc, rrc, sll, srl, sra, swap) the st7 assembler optimizes the use of long and short addressing modes. table 24. cpu addressing mode overview addressing mode example inherent nop immediate ld a,#$55 direct ld a,$55 indexed ld a,($55,x) indirect ld a,([$55],x) relative jrne loop bit operation bset byte,#5 mode syntax destination pointer address (hex.) pointer size (hex.) length (bytes) inherent nop + 0 immediate ld a,#$55 + 1 short direct ld a,$10 00..ff + 1 long direct ld a,$1000 0000..ffff + 2 no offset direct indexed ld a,(x) 00..ff + 0 short direct indexed ld a,($10,x) 00..1fe + 1 long direct indexed ld a,($1000,x) 0000..ffff + 2 short indirect ld a,[$10] 00..ff 00..ff byte + 2 long indirect ld a,[$10.w] 0000..ffff 00..ff word + 2 short indirect indexed ld a,([$10],x) 00..1fe 00..ff byte + 2 long indirect indexed ld a,([$10.w],x) 0000..ffff 00..ff word + 2 relative direct jrne loop pc+/-127 + 1 relative indirect jrne [$10] pc+/-127 00..ff byte + 2 bit direct bset $10,#7 00..ff + 1 bit indirect bset [$10],#7 00..ff 00..ff byte + 2 bit direct relative btjt $10,#7,skip 00..ff + 2 bit indirect relative btjt [$10],#7,skip 00..ff 00..ff byte + 3 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 93/132 instruction set overview (contd) 11.1.1 inherent all inherent instructions consist of a single byte. the opcode fully specifies all the required informa- tion for the cpu to process the operation. 11.1.2 immediate immediate instructions have two bytes, the first byte contains the opcode, the second byte con- tains the operand value. 11.1.3 direct in direct instructions, the operands are referenced by their memory address. the direct addressing mode consists of two sub- modes: direct (short) the address is a byte, thus requires only one byte after the opcode, but only allows 00 - ff address- ing space. direct (long) the address is a word, thus allowing 64 kbyte ad- dressing space, but requires 2 bytes after the op- code. 11.1.4 indexed (no offset, short, long) in this mode, the operand is referenced by its memory address, which is defined by the unsigned addition of an index register (x or y) with an offset. the indirect addressing mode consists of three sub-modes: indexed (no offset) there is no offset, (no extra byte after the opcode), and allows 00 - ff addressing space. indexed (short) the offset is a byte, thus requires only one byte af- ter the opcode and allows 00 - 1fe addressing space. indexed (long) the offset is a word, thus allowing 64 kbyte ad- dressing space and requires 2 bytes after the op- code. 11.1.5 indirect (short, long) the required data byte to do the operation is found by its memory address, located in memory (point- er). the pointer address follows the opcode. the indi- rect addressing mode consists of two sub-modes: indirect (short) the pointer address is a byte, the pointer size is a byte, thus allowing 00 - ff addressing space, and requires 1 byte after the opcode. indirect (long) the pointer address is a byte, the pointer size is a word, thus allowing 64 kbyte addressing space, and requires 1 byte after the opcode. inherent instruction function nop no operation trap s/w interrupt wfi wait for interrupt (low pow- er mode) halt halt oscillator (lowest power mode) ret sub-routine return iret interrupt sub-routine return sim set interrupt mask (level 3) rim reset interrupt mask (level 0) scf set carry flag rcf reset carry flag rsp reset stack pointer ld load clr clear push/pop push/pop to/from the stack inc/dec increment/decrement tnz test negative or zero cpl, neg 1 or 2 complement mul byte multiplication sll, srl, sra, rlc, rrc shift and rotate operations swap swap nibbles immediate instruction function ld load cp compare bcp bit compare and, or, xor logical operations adc, add, sub, sbc arithmetic operations www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 94/132 instruction set overview (contd) 11.1.6 indirect indexed (short, long) this is a combination of indirect and short indexed addressing modes. the operand is referenced by its memory address, which is defined by the un- signed addition of an index register value (x or y) with a pointer value located in memory. the point- er address follows the opcode. the indirect indexed addressing mode consists of two sub-modes: indirect indexed (short) the pointer address is a byte, the pointer size is a byte, thus allowing 00 - 1fe addressing space, and requires 1 byte after the opcode. indirect indexed (long) the pointer address is a byte, the pointer size is a word, thus allowing 64 kbyte addressing space, and requires 1 byte after the opcode. table 25. instructions supporting direct, indexed, indirect and indirect indexed addressing modes 11.1.7 relative mode (direct, indirect) this addressing mode is used to modify the pc register value, by adding an 8-bit signed offset to it. the relative addressing mode consists of two sub- modes: relative (direct) the offset is following the opcode. relative (indirect) the offset is defined in memory, which address follows the opcode. long and short instructions function ld load cp compare and, or, xor logical operations adc, add, sub, sbc arithmetic additions/sub- stractions operations bcp bit compare short instructions only function clr clear inc, dec increment/decrement tnz test negative or zero cpl, neg 1 or 2 complement bset, bres bit operations btjt, btjf bit test and jump opera- tions sll, srl, sra, rlc, rrc shift and rotate opera- tions swap swap nibbles call, jp call or jump subroutine available relative direct/indirect instructions function jrxx conditional jump callr call relative www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 95/132 instruction set overview (contd) 11.2 instruction groups the st7 family devices use an instruction set consisting of 63 instructions. the instructions may be subdivided into 13 main groups as illustrated in the following table: using a pre-byte the instructions are described with one to four op- codes. in order to extend the number of available op- codes for an 8-bit cpu (256 opcodes), three differ- ent prebyte opcodes are defined. these prebytes modify the meaning of the instruction they pre- cede. the whole instruction becomes: pc-2 end of previous instruction pc-1 prebyte pc opcode pc+1 additional word (0 to 2) according to the number of bytes required to compute the ef- fective address these prebytes enable instruction in y as well as indirect addressing modes to be implemented. they precede the opcode of the instruction in x or the instruction using direct addressing mode. the prebytes are: pdy 90 replace an x based instruction using immediate, direct, indexed, or inherent ad- dressing mode by a y one. pix 92 replace an instruction using di- rect, direct bit, or direct relative addressing mode to an instruction using the corresponding indirect addressing mode. it also changes an instruction using x indexed ad- dressing mode to an instruction using indirect x in- dexed addressing mode. piy 91 replace an instruction using x in- direct indexed addressing mode by a y one. load and transfer ld clr stack operation push pop rsp increment/decrement inc dec compare and tests cp tnz bcp logical operations and or xor cpl neg bit operation bset bres conditional bit test and branch btjt btjf arithmetic operations adc add sub sbc mul shift and rotates sll srl sra rlc rrc swap sla unconditional jump or call jra jrt jrf jp call callr nop ret conditional branch jrxx interruption management trap wfi halt iret condition code flag modification sim rim scf rcf www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 96/132 instruction set overview (contd) mnemo description function/example dst src i1 h i0 n z c adc add with carry a = a + m + c a m h n z c add addition a = a + m a m h n z c and logical and a = a . m a m n z bcp bit compare a, memory tst (a . m) a m n z bres bit reset bres byte, #3 m bset bit set bset byte, #3 m btjf jump if bit is false (0) btjf byte, #3, jmp1 m c btjt jump if bit is true (1) btjt byte, #3, jmp1 m c call call subroutine callr call subroutine relative clr clear reg, m 0 1 cp arithmetic compare tst(reg - m) reg m n z c cpl one complement a = ffh-a reg, m n z 1 dec decrement dec y reg, m n z halt halt 10 iret interrupt routine return pop cc, a, x, pc i1 h i0 n z c inc increment inc x reg, m n z jp absolute jump jp [tbl.w] jra jump relative always jrt jump relative jrf never jump jrf * jrih jump if port b int pin = 1 (no port b interrupts) jril jump if port b int pin = 0 (port b interrupt) jrh jump if h = 1 h = 1 ? jrnh jump if h = 0 h = 0 ? jrm jump if i1:0 = 11 i1:0 = 11 ? jrnm jump if i1:0 <> 11 i1:0 <> 11 ? jrmi jump if n = 1 (minus) n = 1 ? jrpl jump if n = 0 (plus) n = 0 ? jreq jump if z = 1 (equal) z = 1 ? jrne jump if z = 0 (not equal) z = 0 ? jrc jump if c = 1 c = 1 ? jrnc jump if c = 0 c = 0 ? jrult jump if c = 1 unsigned < jruge jump if c = 0 jmp if unsigned >= jrugt jump if (c + z = 0) unsigned > www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 97/132 instruction set overview (contd) mnemo description function/example dst src i1 h i0 n z c jrule jump if (c + z = 1) unsigned <= ld load dst <= src reg, m m, reg n z mul multiply x,a = x * a a, x, y x, y, a 0 0 neg negate (2's compl) neg $10 reg, m n z c nop no operation or or operation a = a + m a m n z pop pop from the stack pop reg reg m pop cc cc m i1 h i0 n z c push push onto the stack push y m reg, cc rcf reset carry flag c = 0 0 ret subroutine return rim enable interrupts i1:0 = 10 (level 0) 1 0 rlc rotate left true c c <= a <= c reg, m n z c rrc rotate right true c c => a => c reg, m n z c rsp reset stack pointer s = max allowed sbc substract with carry a = a - m - c a m n z c scf set carry flag c = 1 1 sim disable interrupts i1:0 = 11 (level 3) 1 1 sla shift left arithmetic c <= a <= 0 reg, m n z c sll shift left logic c <= a <= 0 reg, m n z c srl shift right logic 0 => a => c reg, m 0 z c sra shift right arithmetic a7 => a => c reg, m n z c sub substraction a = a - m a m n z c swap swap nibbles a7-a4 <=> a3-a0 reg, m n z tnz test for neg & zero tnz lbl1 n z trap s/w trap s/w interrupt 1 1 wfi wait for interrupt 1 0 xor exclusive or a = a xor m a m n z www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 98/132 12 electrical characteristics 12.1 parameter conditions unless otherwise specified, all voltages are re- ferred to v ss . 12.1.1 minimum and maximum values unless otherwise specified the minimum and max- imum values are guaranteed in the worst condi- tions of ambient temperature, supply voltage and frequencies by tests in production on 100% of the devices with an ambient temperature at t a =25c and t a =t a max (given by the selected temperature range). data based on characterization results, design simulation and/or technology characteristics are indicated in the table footnotes and are not tested in production. based on characterization, the min- imum and maximum values refer to sample tests and represent the mean value plus or minus three times the standard deviation (mean3 s ). 12.1.2 typical values unless otherwise specified, typical data are based on t a =25c, v dd =5v. they are given only as de- sign guidelines and are not tested. 12.1.3 typical curves unless otherwise specified, all typical curves are given only as design guidelines and are not tested. 12.1.4 loading capacitor the loading conditions used for pin parameter measurement are shown in figure 52 . figure 52. pin loading conditions 12.1.5 pin input voltage the input voltage measurement on a pin of the de- vice is described in figure 53 . figure 53. pin input voltage c l st7 pin v in st7 pin www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 99/132 12.2 absolute maximum ratings stresses above those listed as absolute maxi- mum ratings may cause permanent damage to the device. this is a stress rating only and func- tional operation of the device under these condi- tions is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. 12.2.1 voltage characteristics 12.2.2 current characteristics notes: 1. directly connecting the reset and i/o pins to v dd or v ss could damage the device if an unintentional internal reset is generated or an unexpected change of the i/o configuration occurs (for example, due to a corrupted program counter). to guarantee safe operation, this connection has to be done through a pull-up or pull-down resistor (typical: 4.7k w for reset , 10k w for i/os). unused i/o pins must be tied in the same way to v dd or v ss according to their reset configuration. 2. when the current limitation is not possible, the v in absolute maximum rating must be respected, otherwise refer to i inj(pin) specification. a positive injection is induced by v in >v dd while a negative injection is induced by v in st7262 100/132 12.2.3 thermal characteristics 12.3 operating conditions 12.3.1 general operating conditions (standard voltage rom and flash devices) . figure 54. f cpu versus v dd for standard voltage devices table 26. general operating conditions (low voltage rom devices, no usb, no adc)) symbol ratings value unit t stg storage temperature range -65 to +150 c t j maximum junction temperature 175 c symbol parameter conditions min typ max unit v dd operating supply voltage f cpu = 8 mhz 455.5 v dda analog reference voltage v dd v dd v ssa analog reference voltage v ss v ss f cpu operating frequency f osc = 12mhz 8 mhz f osc = 6mhz 4 t a ambient temperature range 070c symbol parameter conditions min typ max unit v dd operating supply voltage f cpu = 4 mhz 3 5 5.5 v dda analog reference voltage v dd v dd v ssa analog reference voltage v ss v ss f cpu operating frequency f osc = 6mhz 4 mhz t a ambient temperature range 070c f cpu [mhz] supply voltage [v] 8 4 2 0 2.5 3.0 3.5 4 4.5 5 5.5 functionality not guaranteed in this area functionality guaranteed in this area (unless otherwise specified in the tables of parametric data) www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 101/132 operating conditions (contd) figure 55. f cpu versus v dd for low voltage devices 12.3.2 operating conditions with low voltage detector (lvd) subject to general operating conditions for v dd , f cpu , and t a . refer to figure 15 on page 21 . notes: 1. not tested, guaranteed by design. 2. not tested in production, guaranteed by characterization. 3. the v dd rise time rate condition is needed to insure a correct device power-on and lvd reset. not tested in production. f cpu [mhz] supply voltage [v] 8 4 2 0 2.5 3.0 3.5 4 4.5 5 5.5 functionality not guaranteed in this area functionality guaranteed in this area (unless otherwise specified in the tables of parametric data) symbol parameter conditions min typ 1) max unit v it+ low voltage reset threshold (v dd rising) v dd max. variation 50v/ms 3.6 3.8 3.95 v v it- low voltage reset threshold (v dd falling) v dd max. variation 50v/ms 3.45 3.65 3.8 v v hyst hysteresis (v it+ - v it- ) 120 2) 150 2) 180 2) mv vt por v dd rise time rate 3) 0.5 50 v/ms www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 102/132 12.4 supply current characteristics the following current consumption specified for the st7 functional operating modes over tempera- ture range does not take into account the clock source current consumption. to get the total de- vice consumption, the two current values must be added (except for halt mode for which the clock is stopped). note 1: typical data are based on t a =25c and not tested in production note 2: data based on design simulation, not tested in production. note 3: usb transceiver and adc are powered down. note 4: low voltage reset function enabled. cpu in halt mode. current consumption of external pull-up (1.5kohms to usbvcc) and pull-down (15kohms to v ssa ) not included. figure 56. typ. i dd in run at 4 and 8 mhz f cpu figure 57. typ. i dd in wait at 4 and 8 mhz f cpu symbol parameter conditions typ 1) max unit d i dd( d ta) supply current variation vs. temperature constant v dd and f cpu 10 % i dd cpu run mode i/os in input mode. usb transceiver and lvd disabled f cpu = 4 mhz 6 8 ma f cpu = 8 mhz 8 14 lvd enabled. usb in transmission 2) f cpu = 4 mhz 13 18 ma f cpu = 8 mhz 15 24 ma cpu wait mode 2) i/os in input mode. usb transceiver and lvd disabled f cpu = 8 mhz 7 12 ma lvd enabled. usb in transmission f cpu = 8 mhz 14 22 ma cpu halt mode 3) with lvd 4) 130 200 m a without lvd 30 50 usb suspend mode 4) 130 200 m a i dd(adc) adc supply current when converting f adc =4mhz 1000 2) m a 0 2 4 6 8 10 12 3 3.5 4 4.5 5 5.5 6 vdd (v) idd (ma) idd run at fcpu=4 mhz idd run at fcpu=8 mhz 0 1 2 3 4 5 6 7 8 9 10 1234567 vdd (v) idd (ma) idd wfi at fcpu=4 mhz idd wfi at fcpu=8 mhz www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 103/132 12.5 clock and timing characteristics subject to general operating conditions for v dd , f cpu , and t a . 12.5.1 general timings 1. data based on typical application software. 2. time measured between interrupt event and interrupt vector fetch. d t c(inst) is the number of t cpu cycles needed to finish the current instruction execution. 12.5.2 control timing characteristics note 1: the minimum period t ilil should not be less than the number of cycle times it takes to execute the interrupt service routine plus 21 cycles. note 2: not tested in production, guaranteed by design. symbol parameter conditions min typ 1) max unit t c(inst) instruction cycle time f cpu =8mhz 2 3 12 t cpu 250 375 1500 ns t v(it) interrupt reaction time 2) t v(it) = d t c(inst) + 10 t cpu f cpu =8mhz 10 22 t cpu 1.25 2.75 m s control timings symbol parameter conditions value unit min 2) typ. 2) max 2) f osc oscillator frequency 12 mhz f cpu operating frequency 8 mhz t rl external reset input pulse width 1.5 t cpu t porl internal power reset duration 514 t cpu t rstl reset pin output pulse width 10 s t wdg watchdog time-out f cpu = 8mhz 65536 8.192 4194304 524.288 t cpu ms t oxov crystal oscillator start-up time 20 30 40 ms t ddr power up rise time from v dd = 0 to 4v 100 ms www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 104/132 clock and timing characteristics (contd) 12.5.3 external clock source figure 58. typical application with an external clock source figure 59. typical application with a crystal resonator symbol parameter conditions min typ max unit v oscinh oscin input pin high level voltage see figure 58 0.7xv dd v dd v v oscinl oscin input pin low level voltage v ss 0.3xv dd t w(oscinh) t w(oscinl) oscin high or low time 1) 15 ns t r(oscin) t f(oscin) oscin rise or fall time 1) 15 i l oscx input leakage current v ss v in v dd 1 m a oscin oscout f osc external st72xxx clock source not connected internally v oscinl v oscinh t r(oscin) t f(oscin) t w(oscinh) t w(oscinl) i l 90% 10% oscout oscin f osc c l1 c l2 i 2 r f st72xxx resonator www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 105/132 12.6 memory characteristics subject to general operating conditions for f cpu , and t a unless otherwise specified. 12.6.1 ram and hardware registers note 1: guaranteed by design. not tested in production. 12.6.2 flash memory operating conditions: f cpu = 8 mhz. figure 60. two typical applications with v pp pin 1) note 1: when the icp mode is not required by the application, v pp pin must be tied to v ss . symbol parameter conditions min typ max unit v rm data retention mode 1) halt mode (or reset) 2.0 v dual voltage flash memory symbol parameter conditions min typ max unit f cpu operating frequency read mode 8 mhz write / erase mode, t a =25c 8 v pp programming voltage 4.0v <= v dd <= 5.5v 11.4 12.6 v i pp v pp current write / erase 30 ma t prog byte programming time t a =25c 100 500 s t erase sector erasing time 2 10 sec device erasing time 5 10 t vpp internal v pp stabilization time 10 s t ret data retention t a 55c 20 years n rw write erase cycles t a =25c 100 cycles v pp st72xxx 10k w programming tool v pp st72xxx www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 106/132 12.7 emc characteristics susceptibility tests are performed on a sample ba- sis during product characterization. 12.7.1 functional ems (electro magnetic susceptibility) based on a simple running application on the product (toggling 2 leds through i/o ports), the product is stressed by two electro magnetic events until a failure occurs (indicated by the leds). n esd: electro-static discharge (positive and negative) is applied on all pins of the device until a functional disturbance occurs. this test conforms with the iec 1000-4-2 standard. n ftb: a burst of fast transient voltage (positive and negative) is applied to v dd and v ss through a 100pf capacitor, until a functional disturbance occurs. this test conforms with the iec 1000-4- 4 standard. a device reset allows normal operations to be re- sumed. notes: 1. data based on characterization results, not tested in production. symbol parameter conditions neg 1) pos 1) unit v fesd voltage limits to be applied on any i/o pin to induce a functional disturbance v dd = 5v, t a = +25c, f osc = 8mhz conforms to iec 1000-4-2 0.7 1 kv v fftb fast transient voltage burst limits to be ap- plied through 100pf on v dd and v dd pins to induce a functional disturbance v dd = 5v, t a = +25c, f osc = 8mhz conforms to iec 1000-4-4 22 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 107/132 emc characteristics (contd) 12.7.2 absolute electrical sensitivity based on three different tests (esd, lu and dlu) using specific measurement methods, the product is stressed in order to determine its performance in terms of electrical sensitivity. for more details, re- fer to the an1181 st7 application note. 12.7.2.1 electro-static discharge (esd) electro-static discharges (1 positive then 1 nega- tive pulse separated by 1 second) are applied to the pins of each sample according to each pin combination. the sample size depends of the number of supply pins of the device (3 parts*(n+1) supply pin). the human body model is simulated. this test conforms to the jesd22-a114a stand- ard. see figure 61 and the following test sequenc- es. human body model test sequence C c l is loaded through s1 by the hv pulse gener- ator. C s1 switches position from generator to r. C a discharge from c l through r (body resistance) to the st7 occurs. C s2 must be closed 10 to 100ms after the pulse delivery period to ensure the st7 is not left in charge state. s2 must be opened at least 10ms prior to the delivery of the next pulse. 12.7.2.2 designing hardened software to avoid noise problems emc characterization and optimization are per- formed at component level with a typical applica- tion environment and simplified mcu software. it should be noted that good emc performance is highly dependent on the user application and the software in particular. therefore it is recommended that the user applies emc software optimization and prequalification tests in relation with the emc level requested for his application. software recommendations: the software flowchart must include the manage- ment of runaway conditions such as: C corrupted program counter C unexpected reset C critical data corruption (control registers...) prequalification trials: most of the common failures (unexpected reset and program counter corruption) can be repro- duced by manually forcing a low state on the re- set pin or the oscillator pins for 1 second. to complete these trials, esd stress can be ap- plied directly on the device,over the range of spec- ification values.when unexpected behaviour is de- tected,the sofware can be hardened to prevent un- recoverable errors occurring (see application note an1015). absolute maximum ratings figure 61. typical equivalent esd circuits notes: 1. data based on characterization results, not tested in production. symbol ratings conditions maximum value 1) unit v esd(hbm) electro-static discharge voltage (human body model) t a = +25c 2000 v st7 s2 r=1500 w s1 high voltage c l = 100pf pulse generator human body model www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 108/132 emc characteristics (contd) 12.7.2.3 static and dynamic latch-up n lu: 3 complementary static tests are required on 10 parts to assess the latch-up performance. a supply overvoltage (applied to each power supply pin), a current injection (applied to each input, output and configurable i/o pin) and a power supply switch sequence are performed on each sample. this test conforms to the eia/ jesd 78 ic latch-up standard. for more details, refer to the an1181 st7 application note. n dlu: electro-static discharges (one positive then one negative test) are applied to each pin of 3 samples when the micro is running to assess the latch-up performance in dynamic mode. power supplies are set to the typical values, the oscillator is connected as near as possible to the pins of the micro and the component is put in reset mode. this test conforms to the iec1000-4-2 and saej1752/3 standards and is described in figure 62 . for more details, refer to the an1181 st7 application note. electrical sensitivities figure 62. simplified diagram of the esd generator for dlu notes: 1. class description: a class is an stmicroelectronics internal specification. all its limits are higher than the jedec spec- ifications, that means when a device belongs to class a it exceeds the jedec standard. b class strictly covers all the jedec criteria (international standard). 2. schaffner nsg435 with a pointed test finger. symbol parameter conditions class 1) lu static latch-up class t a = +25c a dlu dynamic latch-up class v dd = 5.5v, f osc = 4mhz, t a = +25c a r ch =50m w r d =330 w c s = 150pf esd hv relay discharge tip discharge return connection generator 2) st7 v dd v ss www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 109/132 emc characteristics (contd) 12.7.3 esd pin protection strategy to protect an integrated circuit against electro- static discharge the stress must be controlled to prevent degradation or destruction of the circuit el- ements. the stress generally affects the circuit el- ements which are connected to the pads but can also affect the internal devices when the supply pads receive the stress. the elements to be pro- tected must not receive excessive current, voltage or heating within their structure. an esd network combines the different input and output esd protections. this network works, by al- lowing safe discharge paths for the pins subjected to esd stress. two critical esd stress cases are presented in figure 63 and figure 64 for standard pins and in figure 65 and figure 66 for true open drain pins. standard pin protection to protect the output structure the following ele- ments are added: C a diode to v dd (3a) and a diode from v ss (3b) C a protection device between v dd and v ss (4) to protect the input structure the following ele- ments are added: C a resistor in series with the pad (1) C a diode to v dd (2a) and a diode from v ss (2b) C a protection device between v dd and v ss (4) figure 63. positive stress on a standard pad vs. v ss figure 64. negative stress on a standard pad vs. v dd in v dd v ss (1) (2a) (2b) (4) out v dd v ss (3a) (3b) main path path to avoid in v dd v ss (1) (2a) (2b) (4) out v dd v ss (3a) (3b) main path www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 110/132 emc characteristics (contd) true open drain pin protection the centralized protection (4) is not involved in the discharge of the esd stresses applied to true open drain pads due to the fact that a p-buffer and diode to v dd are not implemented. an additional local protection between the pad and v ss (5a & 5b) is implemented to completely absorb the posi- tive esd discharge. multisupply configuration when several types of ground (v ss , v ssa , ...) and power supply (v dd , v dda , ...) are available for any reason (better noise immunity...), the structure shown in figure 67 is implemented to protect the device against esd. figure 65. positive stress on a true open drain pad vs. v ss figure 66. negative stress on a true open drain pad vs. v dd figure 67. multisupply configuration in v dd v ss (1) (2b) (4) out v dd v ss (3b) main path path to avoid (5a) (5b) in v dd v ss (1) (2b) (4) out v dd v ss (3b) main path (3b) (3b) v dda v ssa v dda v dd v ss back to back diode between grounds v ssa www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 111/132 12.8 i/o port pin characteristics 12.8.1 general characteristics subject to general operating conditions for v dd , f cpu , and t a unless otherwise specified. figure 68. two typical applications with unused i/o pin figure 69. typical i pu vs. v dd with v in =v ss figure 70. typical r pu vs. v dd with v in =v ss notes: 1. unless otherwise specified, typical data are based on t a =25c and v dd =5v, not tested in production. 2. configuration not recommended, all unused pins must be kept at a fixed voltage: using the output mode of the i/o for example or an external pull-up or pull-down resistor (see figure 68 ). data based on design simulation and/or technology characteristics, not tested in production. 3. the r pu pull-up equivalent resistor is based on a resistive transistor (corresponding i pu current characteristics de- scribed in figure 69 ). this data is based on characterization results. 4. to generate an external interrupt, a minimum pulse width has to be applied on an i/o port pin configured as an external interrupt source. symbol parameter conditions min typ 1) max unit v il input low level voltage 0.3xv dd v v ih input high level voltage 0.7xv dd v in input voltage true open drain i/o pins v ss 6.0 v other i/o pins v dd v hys schmitt trigger voltage hysteresis 400 mv i l input leakage current v ss v in v dd 1 m a i s static current consumption 2) floating input mode 200 r pu weak pull-up equivalent resistor 3) v in = v ss v dd =5v 50 80 150 k w c io i/o pin capacitance 5 pf t f(io)out output high to low level fall time c l =50pf between 10% and 90% 25 ns t r(io)out output low to high level rise time 25 t w(it)in external interrupt pulse time 4) 1t cpu 10k w unused i/o port st72xxx 10k w unused i/o port st72xxx v dd -90.0 -80.0 -70.0 -60.0 -50.0 -40.0 -30.0 -20.0 -10.0 0.0 3.0 3.5 4.0 4.5 5.0 5.5 6.0 vdd (v) ipu (a) 0 20 40 60 80 100 120 140 160 180 3.0 3.5 4.0 4.5 5.0 5.5 6.0 vdd (v) rpu (k ) www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 112/132 i/o port pin characteristics (contd) 12.8.2 output driving current subject to general operating condition for v dd , f cpu , and t a unless otherwise specified. figure 71. typ. v ol at v dd =5v (std. port) figure 72. typ. v ol at v dd =5v (high-sink) figure 73. typ. v dd -v oh at v dd =5v (std. port) figure 74. typ. v dd -v oh at v dd =5v (high-sink) notes: 1. the i io current sunk must always respect the absolute maximum rating specified in section 12.2 and the sum of i io (i/ o ports and control pins) must not exceed i vss . 2. the i io current sourced must always respect the absolute maximum rating specified in section 12.2 and the sum of i io (i/o ports and control pins) must not exceed i vdd . true open drain i/o pins does not have v oh . symbol parameter conditions min max unit v ol 1) output low level voltage for a standard i/o pin when up to 8 pins are sunk at same time (see figure 71 ) v dd =5v i io =+5ma 1.3 v i io =+2ma 0.4 output low level voltage for a high sink i/o pin when up to4 pins are sunk at same time (see figure 72 ) i io =+20ma 1.3 i io =+8ma 0.4 v oh 2) output high level voltage for an i/o pin when up to 8 pins are sourced at same time (see figure 73 ) i io =-5ma v dd -2.0 i io =-2ma v dd -0.8 0 0.2 0.4 0.6 0.8 1 1.2 0123456789 i io (ma) v ol (v) at t a 25c 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0 2.5 5 7.5 10 12.5 15 17.5 20 22.5 i io (ma) v ol (v) at t a =25c 0 0.2 0.4 0.6 0.8 1 1.2 1.4 -7.5 -6.5 -5.5 -4.5 -3.5 -2.5 -1.5 -0.5 i io (ma) v dd -v oh (v) at t a =25c 0 0.05 0.1 0.15 0.2 0.25 0.3 -8 -7 -6 -5 -4 -3 -2 -1 0 i io (ma) v dd -v oh (v) t=25c www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 113/132 i/o port pin characteristics (contd) figure 75. typical v ol vs. v dd (standard port) figure 76. typical v ol vs. v dd (high-sink port) figure 77. typical v dd -v oh vs. v dd (standard port) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 3.5 4 4.5 5 5.5 6 v dd (v ) v ol (v) at i io =5ma 0 0.05 0.1 0.15 0.2 0.25 3.544.555.56 v dd (v) v ol (v) at i io =2ma 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 3.544.555.56 v dd (v) v ol (v) at i io =20ma 0 0.05 0.1 0.15 0.2 0.25 0.3 3.5 4 4.5 5 5.5 6 v dd (v) v ol high sink port (v) at i io =8ma 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 3.5 4 4.5 5 5.5 6 v dd (v) v dd -v oh (v) at i io =-2ma 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 3.5 4 4.5 5 5.5 6 v dd (v) v dd -v oh (v) at i io =-5ma www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 114/132 i/o port pin characteristics (contd) figure 78. typical v dd -v oh vs. v dd (high sink port) 12.9 control pin characteristics 12.9.1 asynchronous reset pin subject to general operating conditions for v dd , f cp , and t a unless otherwise specified. notes: 1. unless otherwise specified, typical data are based on t a =25c and v dd =5v, not tested in production. 2. data based on characterization results, not tested in production. 3. hysteresis voltage between schmitt trigger switching levels. based on characterization results, not tested. 4. the i io current sunk must always respect the absolute maximum rating specified in section 12.2 and the sum of i io (i/ o ports and control pins) must not exceed i vss . 5. the r on pull-up equivalent resistor is based on a resistive transistor (corresponding i on current characteristics de- scribed in figure 79 ). this data is based on characterization results, not tested in production. 6. to guarantee the reset of the device, a minimum pulse has to be applied to reset pin. all short pulses applied on reset pin with a duration below t h(rstl)in can be ignored. 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 3.5 4 4.5 5 5.5 6 vdd (v) v dd -v od (v) at i io =-2ma 0 0.05 0.1 0.15 0.2 0.25 3.5 4 4.5 5 5.5 6 vdd (v) v dd -v od (v) at i io =-5ma symbol parameter conditions min typ 1) max unit v ih input high level voltage 0.7xv dd v dd v v il input low voltage v ss 0.3xv dd v v hys schmitt trigger voltage hysteresis 3) 400 mv v ol output low level voltage 4) (see figure 80 , figure 81 ) v dd =5v i io =5ma 1 v i io =2ma 0.4 r on weak pull-up equivalent resistor 5) v in = v ss 80 160 280 k w t w(rstl)out generated reset pulse duration external pin or internal reset sources 6 30 1/f sfosc m s t h(rstl)in external reset pulse hold time 6) 10 m s www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 115/132 control pin characteristics (contd) figure 79. typical i on vs. v dd with v in =v ss figure 80. typical v ol at v dd =5v (reset ) figure 81. typical v ol vs. v dd (reset ) -60 -50 -40 -30 -20 -10 0 33.544.5 55.566.5 v dd =5v i on (a) 0.0 0.2 0.4 0.6 0.8 1.0 0123456789 i io (ma) v ol (v) 0 0.05 0.1 0.15 0.2 0.25 0.3 33.544.555.566.5 v dd (v) v ol (v) at i io =2ma 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 33.544.555.566.5 v dd (v) v ol (v) at i io =5ma www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 116/132 12.10 timer peripheral characteristics subject to general operating conditions for v dd , f cpu , and t a unless otherwise specified. refer to i/o port characteristics for more details on the input/output alternate function characteristics (output compare, input capture, external clock, pwm output...). 12.10.1 8-bit pwm-art auto-reload timer symbol parameter conditions min typ max unit t res(pwm) pwm resolution time 1t cpu f cpu =8mhz 125 ns f ext art external clock frequency 0 f cpu /2 mhz f pwm pwm repetition rate 0 f cpu /2 res pwm pwm resolution 8 bit v os pwm/dac output step voltage v dd =5v, res=8-bits 20 mv www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 117/132 12.11 communication interface characteristics 12.11.1 usb - universal bus interface (operating conditions t a = 0 to +70c, v dd = 4.0 to 5.25v unless otherwise specified) note 1: rl is the load connected on the usb drivers. note 2: all the voltages are measured from the local ground potential. note 3: not tested in production, guaranteed by design. note 4: to improve emc performance (noise immunity), it is recommended to connect a 100nf capacitor to the usbvcc pin. figure 82. usb: data signal rise and fall time table 27. usb: low-speed electrical characteristics note 1: measured from 10% to 90% of the data signal. for more detailed informations, please refer to chapter 7 (elec- trical) of the usb specification (version 1.1). usb dc electrical characteristics parameter symbol conditions min. max. unit differential input sensitivity vdi i(d+, d-) 0.2 3) v differential common mode range vcm includes vdi range 0.8 3) 2.5 3) v single ended receiver threshold vse 0.8 3) 2.0 3) v static output low vol rl of 1.5k ohms to 3.6v 0.3 v static output high voh rl of 15k ohms to v ss 2.8 3.6 v usbvcc: voltage level 4) usbv v dd =5v 3.00 3.60 v differential data lines v ss tf tr crossover points vcrs parameter symbol conditions min max unit driver characteristics: rise time tr note 1,cl=50 pf 75 ns note 1, cl=600 pf 300 ns fall time tf note 1, cl=50 pf 75 ns note 1, cl=600 pf 300 ns rise/ fall time matching trfm tr/tf 80 120 % output signal crossover voltage vcrs 1.3 2.0 v www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 118/132 communication interface characteristics (contd) 12.11.2 spi - serial peripheral interface subject to general operating condition for v dd , f cpu , and t a unless otherwise specified. refer to i/o port characteristics for more details on the input/output alternate function characteristics (ss , sck, mosi, miso). figure 83. spi slave timing diagram with cpha=0 3) notes: 1. data based on design simulation and/or characterisation results, not tested in production. 2. when no communication is on-going the data output line of the spi (mosi in master mode, miso in slave mode) has its alternate function capability released. in this case, the pin status depends on the i/o port configuration. 3. measurement points are done at cmos levels: 0.3xv dd and 0.7xv dd . symbol parameter conditions min max unit f sck 1/t c(sck) spi clock frequency master f cpu =8mhz f cpu /128 0.0625 f cpu /4 2 mhz slave f cpu =8mhz 0 f cpu /2 4 t r(sck) t f(sck) spi clock rise and fall time see i/o port pin description t su(ss ) ss setup time slave 120 ns t h(ss ) ss hold time slave 120 t w(sckh) t w(sckl) sck high and low time master slave 100 90 t su(mi) t su(si) data input setup time master slave 100 100 t h(mi) t h(si) data input hold time master slave 100 100 t a(so) data output access time slave 0 120 t dis(so) data output disable time slave 240 t v(so) data output valid time slave (after enable edge) 120 t h(so) data output hold time 0 t v(mo) data output valid time master (before capture edge) 0.25 t cpu t h(mo) data output hold time 0.25 ss input sck input cpha=0 mosi input miso output cpha=0 t c(sck) t w(sckh) t w(sckl) t r(sck) t f(sck) t v(so) t a(so) t su(si) t h(si) msb out msb in bit6 out lsb in lsb out seenote2 cpol=0 cpol=1 t su(ss ) t h(ss ) t dis(so) t h(so) see note 2 bit1 in www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 119/132 communication interface characteristics (contd) figure 84. spi slave timing diagram with cpha=1 1) figure 85. spi master timing diagram 1) notes: 1. measurement points are done at cmos levels: 0.3xv dd and 0.7xv dd . 2. when no communication is on-going the data output line of the spi (mosi in master mode, miso in slave mode) has its alternate function capability released. in this case, the pin status depends of the i/o port configuration. ss input sck input cpha=0 mosi input miso output cpha=0 t w(sckh) t w(sckl) t r(sck) t f(sck) t a(so) t su(si) t h(si) msb out bit6 out lsb out see cpol=0 cpol=1 t su(ss ) t h(ss ) t dis(so) t h(so) see note 2 note 2 t c(sck) hz t v(so) msb in lsb in bit1 in ss input sck input cpha=0 mosi output miso input cpha=0 cpha=1 cpha=1 t c(sck) t w(sckh) t w(sckl) t h(mi) t su(mi) t v(mo) t h(mo) msb in msb out bit6 in bit6 out lsb out lsb in see note 2 seenote2 cpol=0 cpol=1 cpol=0 cpol=1 t r(sck) t f(sck) www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 120/132 12.12 10-bit adc characteristics subject to general operating conditions for v dd, f cpu , and t a unless otherwise specified figure 86. r ain max. vs f adc with c ain =0pf 4) figure 87. recommended c ain /r ain values 5) figure 88. typical application with adc notes: 1. unless otherwise specified, typical data are based on t a =25c and v dd -v ss =5v. they are given only as design guide- lines and are not tested. 2. when v dda and v ssa pins are not available on the pinout, the adc refers to v dd and v ss . 3. any added external serial resistor will downgrade the adc accuracy (especially for resistance greater than 10k w ). data based on characterization results, not tested in production. 4. c parasitic represents the capacitance of the pcb (dependent on soldering and pcb layout quality) plus the pad ca- pacitance (3pf). a high c parasitic value will downgrade conversion accuracy. to remedy this, f adc should be reduced. 5. this graph shows that depending on the input signal variation (f ain ), c ain can be increased for stabilization and to allow the use of a larger serial resistor (r ain) . it is valid for all f adc frequencies 4mhz. symbol parameter conditions min typ 1) max unit f adc adc clock frequency 0.4 4 mhz v ain conversion voltage range 2) v ssa v dda v r ain external input impedance see figure 86 and figure 87 3)4)5) k w c ain external capacitor on analog input pf f ain variation frequency of analog input signal hz c adc internal sample and hold capacitor 6 pf t conv conversion time f adc =4mhz 28 m s 112 1/f adc 0 5 10 15 20 25 30 35 40 45 0103070 c parasitic (pf) max. r ain (kohm) 4 mhz 2 mhz 1 mhz 0.1 1 10 100 1000 0.01 0.1 1 10 f ain (khz) max. r ain (kohm) cain 10 nf cain 22 nf cain 47 nf ainx st72xxx v dd i l 1 m a v t 0.6v v t 0.6v c adc 6pf v ain r ain 10-bit a/d conversion 2k w( max ) c ain www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 121/132 adc characteristics (contd) 12.12.0.1 analog power supply and reference pins depending on the mcu pin count, the package may feature separate v dda and v ssa analog pow- er supply pins. these pins supply power to the a/d converter cell and function as the high and low ref- erence voltages for the conversion. in smaller packages v dda and v ssa pins are not available and the analog supply and reference pads are in- ternally bonded to the v dd and v ss pins. separation of the digital and analog power pins al- low board designers to improve a/d performance. conversion accuracy can be impacted by voltage drops and noise in the event of heavily loaded or badly decoupled power supply lines (see section 10.7.3.2 pcb design guidelines ). 12.12.0.2 general pcb design guidelines to obtain best results, some general design and layout rules should be followed when designing the application pcb to shield the the noise-sensi- tive, analog physical interface from noise-generat- ing cmos logic signals. C use separate digital and analog planes. the an- alog ground plane should be connected to the digital ground plane via a single point on the pcb. C filter power to the analog power planes. the best solution is to connect capacitors, with good high frequency characteristics, between the power and ground lines, placing 0.1f and 10pf capacitors as close as possible to the st7 power supply pins and a 10f capacitor close to the power source (see figure 89 ). C the analog and digital power supplies should be connected in a star nework. do not use a resis- tor, as v dda is used as a reference voltage by the a/d converter and any resistance would cause a voltage drop and a loss of accuracy. C properly place components and route the signal traces on the pcb to shield the analog inputs. analog signals paths should run over the analog ground plane and be as short as possible. isolate analog signals from digital signals that may switch while the analog inputs are being sampled by the a/d converter. do not toggle digital out- puts on the same i/o port as the a/d input being converted. 12.12.0.3 specific application design guidelines C when a usb transmission is taking place during a/d conversion, the noise caused on the analog power supply by the usb transmission may re- sult in a loss of adc accuracy. C if the usb is used to supply power to the appli- cation, this causes noise which may result in a loss of adc accuracy. figure 89. power supply filtering v ss v dd 0.1 m f 10pf v dd st72xxx v dda v ssa power supply source st7 digital noise filtering external noise filtering 10 m f 0.1 m f 10pf www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 122/132 adc characteristics (contd) adc accuracy with f cpu =8 mhz, f adc =4 mhz r ain < 10 k w figure 90. adc accuracy characteristics notes: 1) not tested in production, guaranteed by characterization. 2) adc accuracy vs. negative injection current: injecting negative current on any of the analog input pins significantly reduces the accuracy of the conversion being per- formed on another analog input. for i inj- =0.8ma, the typical leakage induced inside the die is 1.6a and the effect on the adc accuracy is a loss of 4 lsb for each 10k w increase of the external analog source impedance. it is recommended to add a schottky diode (pin to ground) to analog pins which may potentially inject negative current. any positive injection current within the limits spec- ified for i inj(pin) and s i inj(pin) in section 12.8 does not affect the adc accuracy. symbol parameter conditions typ max unit |e t | total unadjusted error v dd = 4v-5.5v 3 1) lsb |e o | offset error 1 1) 2 1) |e g | gain error 0.7 1) 2 1) |e d | differential linearity error 1.3 1) 2 1) |e l | integral linearity error 2.9 1) 5 1) e o e g 1lsb ideal 1lsb ideal v dda v ssa C 1024 ---------------------------------------- - = v in (lsb ideal ) (1) example of an actual transfer curve (2) the ideal transfer curve (3) end point correlation line e t =total unadjusted error: maximum deviation between the actual and the ideal transfer curves. e o =offset error: deviation between the first actual transition and the first ideal one. e g =gain error: deviation between the last ideal transition and the last actual one. e d =differential linearity error: maximum deviation between actual steps and the ideal one. e l =integral linearity error: maximum deviation between any actual transition and the end point correlation line. digital result adcdr 1023 1022 1021 5 4 3 2 1 0 7 6 1234567 1021 1022 1023 1024 (1) (2) e t e d e l (3) v dda v ssa www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 123/132 13 package characteristics 13.1 package mechanical data figure 91. 44-pin thin quad flat package figure 92. 42-pin shrink plastic dual in-line package, 600-mil width dim mm inches min typ max min typ max a 1.60 0.063 a1 0.05 0.15 0.002 0.006 a2 1.35 1.40 1.45 0.053 0.055 0.057 b 0.30 0.37 0.45 0.012 0.015 0.018 c 0.09 0.20 0.004 0.008 d 12.00 0.472 d1 10.00 0.394 d3 8.00 0.315 e 12.00 0.472 e1 10.00 0.394 e3 8.00 0.315 e 0.80 0.031 k 0 3.5 7 l 0.45 0.60 0.75 0.018 0.024 0.030 l1 1.00 0.039 number of pins n 44 b c l1 l k 0.10mm .004 dim. mm inches min typ max min typ max a 5.08 0.200 a1 0.51 0.020 a2 3.05 3.81 4.57 0.120 0.150 0.180 b 0.46 0.56 0.018 0.022 b2 1.02 1.14 0.040 0.045 c 0.23 0.25 0.38 0.009 0.010 0.015 d 36.58 36.83 37.08 1.440 1.450 1.460 e 15.24 16.00 0.600 0.630 e1 12.70 13.72 14.48 0.500 0.540 0.570 e 1.78 0.070 ea 15.24 0.600 eb 18.54 0.730 ec 0.00 1.52 0.000 0.060 l 2.54 3.30 3.56 0.100 0.130 0.140 number of pins n42 pdip42s www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 124/132 figure 93. 34-pin plastic small outline package figure 94. 32-pin shrink plastic dual in line package dim. mm inches min typ max min typ max a 2.46 2.64 0.097 0.104 a1 0.13 0.29 0.005 0.0115 b 0.36 0.48 0.014 0.019 c 0.23 0.32 0.0091 0.0125 d 17.73 18.06 0.698 0.711 e 7.42 7.59 0.292 0.299 e 1.02 0.040 h 10.16 10.41 0.400 0.410 h 0.64 0.74 0.025 0.029 k 0 8 l 0.61 1.02 0.024 0.040 number of pins n34 so34s 0.10mm .004 dim. mm inches min typ max min typ max a 3.56 3.76 5.08 0.140 0.148 0.200 a1 0.51 0.020 a2 3.05 3.56 4.57 0.120 0.140 0.180 b 0.36 0.46 0.58 0.014 0.018 0.023 b1 0.76 1.02 1.40 0.030 0.040 0.055 c 0.20 0.25 0.36 0.008 0.010 0.014 d 27.43 27.94 28.45 1.080 1.100 1.120 e 9.91 10.41 11.05 0.390 0.410 0.435 e1 7.62 8.89 9.40 0.300 0.350 0.370 e 1.78 0.070 ea 10.16 0.400 eb 12.70 0.500 l 2.54 3.05 3.81 0.100 0.120 0.150 number of pins n32 1 n b d vr01725j n/2 b1 e a l see lead detail e 1 e 3 a 2 a 1 e c e b e a www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 125/132 figure 95. 20-pin plastic small outline package, 300-mil width figure 96. 20-pin plastic dual in-line package, 300-mil width dim. mm inches min typ max min typ max a 2.35 2.65 0.0926 0.1043 a1 0.10 0.0040 b 0.33 0.51 0.0130 0.0200 c 0.32 0.0125 d 4.98 13.00 0.1961 0.5118 e 7.40 7.60 0.2914 0.2992 e 1.27 0.050 h 10.01 10.64 0.394 0.419 h 0.25 0.74 0.010 0.029 k 0 8 0 8 l 0.41 1.27 0.016 0.050 g 0.10 0.004 number of pins n20 so20 dim. mm inches min typ max min typ max a 5.33 0.210 a2 2.92 3.30 4.95 0.115 0.130 0.195 b 0.36 0.46 0.56 0.014 0.018 0.022 b2 1.14 1.52 1.78 0.045 0.060 0.070 c 0.20 0.25 0.36 0.008 0.010 0.014 d 24.89 26.92 0.980 1.060 e 2.54 0.100 e1 6.10 6.35 7.11 0.240 0.250 0.280 l 2.92 3.30 3.81 0.115 0.130 0.150 number of pins n 20 pdip20 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 126/132 14 device configuration and ordering information each device is available for production in user pro- grammable versions (flash) as well as in factory coded versions (rom/fastrom). st7262 devices are rom versions. st72p62 de- vices are factory advanced service technique rom (fastrom) versions: they are factory-pro- grammed hdflash devices. ST72F62 flash devices are shipped to custom- ers with a default content (ffh), while fastrom factory coded parts contain the code supplied by the customer. this implies that flash devices have to be configured by the customer using the option byte while the rom devices are factory- configured. 14.1 option byte the option byte allows the hardware configuration of the microcontroller to be selected. the option byte has no address in the memory map and can be accessed only in programming mode using a standard st7 programming tool. the default content of the flash is fixed to ffh. this means that all the options have 1 as their default value. in fastrom devices, the option byte is fixed in hardware by the fastrom code. bits 7:6 = reserved. bit 5 = wdgsw hardware or software watchdog this option bit selects the watchdog type. 0: hardware enabled 1: software enabled bit 4 = nest this option bit selects the nested interrupts fea- ture. 0: nested interrupt feature disabled 1: nested interrupt feature enabled bit 3 = lvd low voltage detector selection this option bit selects the lvd. 0: lvd enabled 1: lvd disabled note: the lvd must be disabled in low voltage devices. bit 2= reserved. bit 1 = osc12/6 oscillator selection this option bit selects the clock divider used to drive the usb interface at 6mhz. 0: 6 mhz oscillator (no divider for usb) 1: 12 mhz oscillator (2 divider for usb) note: the 6 mhz oscillator is mandatory in low voltage devices. bit 0 = fmp_r memory readout protection this option bit allows the protection of the software contents against piracy (program or data). when the protection is activated, read/write access is prevented by hardware. if the protection is deacti- vated, the memory is erased first and the device can be reprogrammed. refer to the st7 flash programming reference manual and section 4.3.1 on page 14 for more details. 0: read-out protection enabled 1: read-out protection disabled 14.2 device ordering information and transfer of customer code customer code is made up of the rom/fas- trom contents and the list of the selected options (if any). the rom or fastrom contents are to be sent on diskette, or by electronic means, with the hexadecimal file in .s19 format generated by the development tool. all unused bytes must be set to ffh. the selected options are communicated to stmi- croelectronics using the correctly completed op- tion list appended. refer to application note an1635 for information on the counter listing returned by st after code has been transferred. the stmicroelectronics sales organization will be pleased to provide detailed information on con- tractual points. 70 -- wdg sw nest lvd - osc 12/6 fmp_ r www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 127/132 device configuration and ordering information (contd) table 28. supported part numbers part number program memory (bytes) ram (bytes) package voltage range ST72F623f2b1 8k flash 384 pdip20 standard ST72F623f2m1 so20 ST72F622k2b1 pdip32 ST72F622l2m1 so34 ST72F621k4b1 16k flash 768 pdip32 ST72F621l4m1 so34 ST72F621j2b1 8k flash 384 pdip42 ST72F621j2t1 tqfp44 ST72F621j4b1 16k flash 768 pdip42 ST72F621j4t1 tqfp44 st72623f2b1 8k rom 384 pdip20 st72623f2m1 so20 st72623f2m1l so20 low st72622k2b1 pdip32 standard st72622l2m1 so34 st72622l2m1l so34 low st72621k4b1 16k rom 768 pdip32 standard st72621l4m1 so34 st72621l4m1l so34 low st72621j2b1 8k rom 384 pdip42 standard st72621j2t1 tqfp44 st72621j2t1l tqfp44 low st72621j4b1 16k rom 768 pdip42 standard st72621j4t1 tqfp44 st72621j4t1l tqfp44 low st72p623f2b1 8k fastrom 384 pdip20 standard st72p623f2m1 so20 st72p622k2b1 pdip32 st72p622l2m1 so34 st72p621k4b1 16k fastrom 768 pdip32 st72p621l4m1 so34 st72p621j2b1 8k fastrom 384 pdip42 st72p621j2t1 tqfp44 st72p621j4b1 16k fastrom 768 pdip42 st72p621j4t1 tqfp44 contact st sales office for product availability www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 128/132 14.3 development tools stmicroelectronics offers a range of hardware and software development tools for the st7 micro- controller family. full details of tools available for the st7 from third party manufacturers can be ob- tain from the stmicroelectronics internet site: ? http//mcu.st.com. tools from these manufacturers include c compli- ers, emulators and gang programmers. stmicroelectronics tools three types of development tool are offered by st see table 29 and table 30 for more details. table 29. stmicroelectronics tools features note : 1. in-circuit programming (icp) interface for flash devices. table 30. dedicated stmicroelectronics development tools note : 1. add suffix /eu or /us for the power supply for your region. in-circuit emulation programming capability 1) software included st7 emulator yes, powerful emulation features including trace/ logic analyzer no st7 cd rom with: C st7 assembly toolchain C stvd7 powerful source level debugger for win 3.1, win 9x and nt C c compiler demo versions C windows programming tools for win 3.1, win 9x and nt st7 programming board no yes (all packages) supported products evaluation board st7 emulator st7 programming board active probe & target emulation board st7262 st7mdtuls-eval st7mdtu2-emu2b st7mdtu2-epb 1) st7mdtu2-dbe2b www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 129/132 st7262 microcontroller option list customer: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . address: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . contact: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . phone no: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . reference/rom or fastrom code* : . . . . . . . . . . . . *the rom or fastrom code name is assigned by stmicroelectronics. rom or fastrom code must be sent in .s19 format. .hex extension cannot be processed. device type/memory size/package (check only one option): conditioning (check only one option): special marking: [ ] no [ ] yes "_ _ _ _ _ _ _ _ _ _ " authorized characters are letters, digits, '.', '-', '/' and spaces only. maximum character count: s020 (8 char. max) : _ _ _ _ _ _ _ _ dip20/dip32/tqfp44 (10 char. max) : _ _ _ _ _ _ _ _ _ _ s034 (13 char. max) : _ _ _ _ _ _ _ _ _ _ _ _ _ dip42 (16 char. max) : _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ low voltage 1) : [ ] yes [ ] no watchdog selection: wdg sw [ ] hardware activation [ ] software activation nested interrupt: nest [ ] disabled [ ] enabled lvd reset 2) : lvd [ ] enabled [ ] disabled oscillator selection 3) : osc12_6 [ ] 6 mhz. [ ] 12 mhz. readout protection: fmp_r [ ] enabled [ ] disabled date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . note 1: low voltage devices available in s020, so34 and tqfp44 only. note 2: must be disabled in low voltage devices note 3: 6 mhz mandatory for low voltage devices --------------------------------- rom device: --------------------------------- | | ----------------------------------------- 8k ----------------------------------------- | | ----------------------------------------- 16k ----------------------------------------- sdip20: | [ ] st72623f2b1 | so20: | [ ] st72623f2m1 | sdip32: | [ ] st72622k2b1 | [ ] st72621k4b1 so34: | [ ] st72622l2m1 | [ ] st72622l4m1 sdip42: | [ ] st72621j2b1 | [ ] st72621j4b1 tqfp44: | [ ] st72621j2t1 | [ ] st72621j4t1 --------------------------------- fastrom device: --------------------------------- | | ------------------------------------------ 8k ------------------------------------------ | | ------------------------------------------ 16k ------------------------------------------ pdip20: | [ ] st72p623f2b1 | so20: | [ ] st72p623f2m1 | sdip32: | [ ] st72p622k2b1 | [ ] st72p621k4b1 so34: | [ ] st72p622l2m1 | [ ] st72p622l4m1 sdip42: | [ ] st72p621j2b1 | [ ] st72p621j4b1 tqfp44: | [ ] st72p621j2t1 | [ ] st72p621j4t1 --------------------------------- die form: --------------------------------- | | ------------------------------------------ 8k ------------------------------------------ | | ------------------------------------------ 16k ------------------------------------------ 20-pin: | [ ] | 32-pin: | [ ] | [ ] 34-pin: | [ ] | [ ] 42-pin: | [ ] | [ ] 44-pin: | [ ] | [ ] ------------------------------------------------------------------------ packaged product (do not specify for dip package) ------------------------------------------------------------------------ | | ----------------------------------------------------- die product (dice tested at 25c only) ----------------------------------------------------- [ ] tape & reel [ ] tray (tqfp package only) | [ ] tape & reel [ ] tube (so package only) | [ ] inked wafer | [ ] sawn wafer on sticky foil www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 130/132 15 important notes 15.1 unexpected reset fetch if an interrupt request occurs while a "pop cc" in- struction is executed, the interrupt controller does not recognise the source of the interrupt and, by default, passes the reset vector address to the cpu. workaround to solve this issue, a "pop cc" instruction must always be preceded by a "sim" instruction. 15.2 halt mode power consumption with adc on if the a/d converter is being used when halt mode is entered, the power consumption in halt mode may exceed the maximum specified in the datash- eet. workaround switch off the adc by software (adon=0) before executing a halt instruction. www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 131/132 16 summary of changes description of the changes between the current release of the specification and the previous one. revision main changes date 2.2 added an important note in section 3 on page 11 added and the device can be reprogrammed in section 4.3.1 on page 14 added section 4.7 related documentation on page 16 removed reference to eicr register (replaced by itrfre2 register) in section 7.2 on page 23 added text specifying that the watchdog is a free-running counter ( section 10.1.2 and sec- tion 10.1.3 on page 40 changed description in section 14 device configuration and ordering infor- mation on page 126 changed name of section 15 on page 130 updated description of fmp_r option bit in section 14.1 on page 126 please read carefully the section important notes on page 130 june 03 www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet
st7262 132/132 notes: information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without the express written approval of stmicroele ctronics. the st logo is a registered trademark of stmicroelectronics ? 2003 stmicroelectronics - all rights reserved. purchase of i 2 c components by stmicroelectronics conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system is granted provided that the system conforms to the i 2 c standard specification as defined by philips. stmicroelectronics group of companies australia - brazil - canada - china - finland - france - germany - hong kong - india - israel - italy - japan malaysia - malta - morocco - singapore - spain - sweden - switzerland - united kingdom - u.s.a. http://www.st.com www.datasheet www.datasheet www.datasheet www.datasheet 4u 4u4u 4u .com .com .com .com 4 .com u datasheet


▲Up To Search▲   

 
Price & Availability of ST72F62

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X